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的更多相关文章

  1. 2016年12月30日 星期五 --出埃及记 Exodus 21:25

    2016年12月30日 星期五 --出埃及记 Exodus 21:25 burn for burn, wound for wound, bruise for bruise.以烙还烙,以伤还伤,以打还打 ...

  2. 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 ...

  3. 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 ...

  4. 北京Uber优步司机奖励政策(12月25日)

    滴快车单单2.5倍,注册地址:http://www.udache.com/ 如何注册Uber司机(全国版最新最详细注册流程)/月入2万/不用抢单:http://www.cnblogs.com/mfry ...

  5. c++中变量声明和变量定义的区别。2016年12月6日

    整个流程: 1.程序告诉cpu,程序将要使用一个变量.(暂时不一定用到,先说一下.) 2.程序告诉CPU,程序现在就要使用一个变量.(现在就用) 3.cpu按照这个变量的类型,把内存划分出几个单位(b ...

  6. Week16(12月23日):复习

    Part I:提问 =========================== 1.声明强类型视图时,使用关键字(    ) A.ViewBag    B.model    C.Type    D.Tit ...

  7. 限时免费 | 12月6日,广州保利洲际酒店,ABC Summit 2018云智峰会来了!

    随着科技的迅猛发展,人工智能技术也逐渐取得了各个突破.自20世纪70年代以来,作为计算机学科的一个分支,人工智能就被列为世界三大尖端技术之一.近年来,阿尔法狗战胜世界第一柯洁,使人工智能再度迎来新的热 ...

  8. 【12月21日】A股滚动市盈率PE历史新低排名

    2010年01月01日 到 2018年12月21日 之间,滚动市盈率历史新低排名.上市三年以上的公司,2018年12月21日市盈率在300以下的公司. 1 - 厦门象屿(SH600057) - 历史新 ...

  9. 【12月06日】A股全市场情绪指标整理分析

    1. A股全市场的股权质押比例 2018年11月30日,A股全市场,质押股数占全市场总股本数比:9.997%,最近2周出现了3.2%的轻微回落.同历史时期相比,仍然处于高位. 2. A股全市场的解禁市 ...

随机推荐

  1. 制作R中分词的字典的办法

    在开始下面步骤之前先让自己的文件可以显示扩展名. 如何显示请谷歌. 第一步:打开一个文本文件 第二步:把你要的词复制到这个文本文件吧. 第三步:将这个文本文件的格式改为dic.即原来文件格式是txt后 ...

  2. YQCB冲刺第二周第四天

    站立会议 任务看板 今天的任务为实现精准查账的功能. 昨天的任务为实现查看消费明细的功能. 遇到的问题为忘记在记账记录的表中添加用户名一栏,这样导致不同用户登录时查看消费明细会显示所有用户的所有记录.

  3. 查询过的问题关于HTML的问题

    一.Bootstrap字体图标(Glyphicons) http://www.runoob.com/bootstrap/bootstrap-glyphicons.html 二.Jquery 实现 “下 ...

  4. c++中队列queue和栈stack的基本操作

    1.queue 模板类的定义在<queue>头文件中. 定义queue 对象的示例代码如下:queue<int> q1;queue<double> q2; queu ...

  5. [2017BUAA软工]个人阅读作业+总结

    阅读作业 没有银弹 No Silver Bullet - Essence and Accidents of Software Engineering - Brooks 在这篇论文中,作者阐述了软件的四 ...

  6. JSONP使用及注意事项小结

    什么是JSONP 三句话总结: 概念:JSONP(JSON with Padding)是JSON的一种"使用模式". 目的:用于解决主流浏览器的跨域数据访问的问题. 原理:利用 & ...

  7. ES6学习笔记(五):Class和Module

    Class Class 只是一个语法糖,其功能用es5也能实现,但是比es5更符合类的期待 定义: constructor代表构造方法,而this指向new 生成的实例 定义类方法时,可以不使用fun ...

  8. 【题解】 bzoj2115: [Wc2011] Xor (线性基+dfs)

    bzoj2115,戳我戳我 Solution: 看得题解(逃,我太菜了,想不出这种做法 那么丢个链接 Attention: 板子别写错了 又写错了这次 \(long long\)是左移63位,多了会溢 ...

  9. 【题解】 bzoj1911: [Apio2010]特别行动队 (动态规划+斜率优化)

    bzoj1911,懒得复制,戳我戳我 Solution: 线性DP(打牌) \(dp\)方程还是很好想的:\(dp[i]=dp[j-1]+a*(s[i]-s[j-1])^2+b*(s[i]-s[j-1 ...

  10. VUE.JS 窗口发生变化时,获取当前窗口的高度。

    VUE.JS # 窗口发生变化时,获取当前窗口的高度. mounted () { const that = this; window.onresize = () => { return (() ...