第12月第25天 ImagePickerSheetController
1.ImagePickerSheetController
open class ImagePickerSheetController: UIViewController, UITableViewDataSource, UITableViewDelegate, UICollectionViewDataSource, UICollectionViewDelegate, UICollectionViewDelegateFlowLayout, UIViewControllerTransitioningDelegate {
...
lazy var backgroundView: UIView = {
let view = UIView()
view.backgroundColor = UIColor(white: 0.0, alpha: 0.3961)
view.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(ImagePickerSheetController.cancel)))
return view
}()
...
override open func loadView() {
super.loadView()
view.addSubview(backgroundView)
view.addSubview(tableView)
}
...
// MARK: - Layout
open override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
backgroundView.frame = view.bounds
let tableViewHeight = Array(..<tableView.numberOfRows(inSection: )).reduce(tableView(tableView, heightForRowAt: IndexPath(row: , section: ))) { total, row in
total + tableView(tableView, heightForRowAt: IndexPath(row: row, section: ))
}
tableView.frame = CGRect(x: view.bounds.minX, y: view.bounds.maxY-tableViewHeight, width: view.bounds.width, height: tableViewHeight)
}
let authorization = PHPhotoLibrary.authorizationStatus()
if authorization == .notDetermined {
PHPhotoLibrary.requestAuthorization({ (status) -> Void in
DispatchQueue.main.async(execute: { () -> Void in
self.pickProfileImage(tap)
})
})
}
if authorization == .authorized {
let controller = ImagePickerSheetController()
controller.addAction(ImageAction(title: NSLocalizedString("Take Photo or Video", comment: "Action Title"), secondaryTitle: NSLocalizedString("Use this one", comment: "Action Title"), handler: { (_) -> () in
self.presentCamera()
}, secondaryHandler: { (action, numberOfPhotos) -> () in
controller.getSelectedImagesWithCompletion({ (images) -> Void in
self.profileImage = images[]
self.userProfileImageView.image = self.profileImage
})
}))
controller.addAction(ImageAction(title: NSLocalizedString("Cancel", comment: "Action Title"), style: .cancel, handler: nil, secondaryHandler: nil))
present(controller, animated: true, completion: nil)
}
https://github.com/allenwong/30DaysofSwift/
第12月第25天 ImagePickerSheetController的更多相关文章
- 2016年12月30日 星期五 --出埃及记 Exodus 21:25
2016年12月30日 星期五 --出埃及记 Exodus 21:25 burn for burn, wound for wound, bruise for bruise.以烙还烙,以伤还伤,以打还打 ...
- 2016年12月25日 星期日 --出埃及记 Exodus 21:20
2016年12月25日 星期日 --出埃及记 Exodus 21:20 "If a man beats his male or female slave with a rod and the ...
- 2016年12月4日 星期日 --出埃及记 Exodus 20:25
2016年12月4日 星期日 --出埃及记 Exodus 20:25 If you make an altar of stones for me, do not build it with dress ...
- 北京Uber优步司机奖励政策(12月25日)
滴快车单单2.5倍,注册地址:http://www.udache.com/ 如何注册Uber司机(全国版最新最详细注册流程)/月入2万/不用抢单:http://www.cnblogs.com/mfry ...
- c++中变量声明和变量定义的区别。2016年12月6日
整个流程: 1.程序告诉cpu,程序将要使用一个变量.(暂时不一定用到,先说一下.) 2.程序告诉CPU,程序现在就要使用一个变量.(现在就用) 3.cpu按照这个变量的类型,把内存划分出几个单位(b ...
- Week16(12月23日):复习
Part I:提问 =========================== 1.声明强类型视图时,使用关键字( ) A.ViewBag B.model C.Type D.Tit ...
- 限时免费 | 12月6日,广州保利洲际酒店,ABC Summit 2018云智峰会来了!
随着科技的迅猛发展,人工智能技术也逐渐取得了各个突破.自20世纪70年代以来,作为计算机学科的一个分支,人工智能就被列为世界三大尖端技术之一.近年来,阿尔法狗战胜世界第一柯洁,使人工智能再度迎来新的热 ...
- 【12月21日】A股滚动市盈率PE历史新低排名
2010年01月01日 到 2018年12月21日 之间,滚动市盈率历史新低排名.上市三年以上的公司,2018年12月21日市盈率在300以下的公司. 1 - 厦门象屿(SH600057) - 历史新 ...
- 【12月06日】A股全市场情绪指标整理分析
1. A股全市场的股权质押比例 2018年11月30日,A股全市场,质押股数占全市场总股本数比:9.997%,最近2周出现了3.2%的轻微回落.同历史时期相比,仍然处于高位. 2. A股全市场的解禁市 ...
随机推荐
- 利用KMP算法解决串的模式匹配问题(c++) -- 数据结构
题目: 7-1 串的模式匹配 (30 分) 给定一个主串S(长度<=10^6)和一个模式T(长度<=10^5),要求在主串S中找出与模式T相匹配的子串,返回相匹配的子串中的第一个字符在主串 ...
- B1014. 福尔摩斯的约会
14/20 #include<bits/stdc++.h> using namespace std; map<char,string> day; int main(){ day ...
- WebShell代码分析溯源(第1题)
<?php $POST['POST']='assert';$array[]=$POST;$array[0]['POST']($_POST['assert']);?> assert,是php ...
- jqgrid查找
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletExcepti ...
- Locality Sensitive Hashing,LSH
1. 基本思想 局部敏感(Locality Senstitive):即空间中距离较近的点映射后发生冲突的概率高,空间中距离较远的点映射后发生冲突的概率低. 局部敏感哈希的基本思想类似于一种空间域转换思 ...
- 【Leetcode】222. Count Complete Tree Nodes
Question: Given a complete binary tree, count the number of nodes. Definition of a complete binary t ...
- nodejs的事件驱动理解
// 引入 events 模块 var events = require('events'); // 创建 eventEmitter 对象 var eventEmitter = new events. ...
- Bootstrap中datetimepicker日期控件1899年问题解决
Bootstrap中datetimepicker日期控件1899年问题解决 最近在开发项目的过程中,遇到一个很尴尬的问题.我们项目一直采用的是angular+bootstrap,日期控件用的是boot ...
- python自动化之调试
#####调试 #####查看日志与断言 ''' 抛出异常使用raise语句.在代码中,raise语句包含以下部分: (1)raise关键字; (2)对Exception函数的调用; (3)传递给Ex ...
- BZOJ2431 HAOI2009逆序对数列(动态规划)
对于排列计数问题一般把数按一个特定的顺序加入排列.这个题做法比较显然,考虑将数从小到大加入排列即可. #include<iostream> #include<cstdio> # ...