第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股全市场的解禁市 ...
随机推荐
- CentOS Docker环境搭建教程
安装与配置 Docker 安装 Docker Docker 软件包已经包括在默认的 CentOS-Extras 软件源里.因此想要安装 docker,只需要运行下面的 yum 命令: yum inst ...
- mui框架(一)
1.界面初始化 初始化就是把一切程序设为默认状态,把没准备的准备好. mui框架将很多功能配置都集中在mui.init方法中,要使用某项功能,只需要在mui.init方法中完成对应参数配置即可,目前支 ...
- PAT甲题题解-1117. Eddington Number(25)-(大么个大水题~)
如题,大水题...贴个代码完事,就这么任性~~ #include <iostream> #include <cstdio> #include <algorithm> ...
- 20135337朱荟潼 Linux第三周学习总结 ——Linux内核源代码简介
朱荟潼 + 原创作品转载请注明出处 + <Linux内核分析>MOOC课http://mooc.study.163.com/course/USTC 1000029000 知识笔记 1.ar ...
- 实训六(Cocos2dx游戏分享到微信朋友圈----AppID的获取)
考虑把游戏分享到微信朋友圈,前面的博文已经写到,shareSDK是一个很好的选择,但是学习了几天时间,遇到了很多问题,与其在一棵树上吊死,还不如退一步海阔天空,先暂时放一放,于是我考虑了一下既然是分享 ...
- Spring所需的Jar包下载
作者:zhidashang 来源:CSDN 原文:https://blog.csdn.net/zhidashang/article/details/78706027 版权声明:本文为博主原创文章,转载 ...
- VS2013快速安装教程
1.下载vs2013安装镜像.VS2013_RTM_ULT_CHS.iso链接: http://pan.baidu.com/s/1mguOdiK密码: rllz 建议使用百度网盘客户端下载,虽然被人 ...
- Alpha冲刺-第一天
1.1 今日完成任务情况以及遇到的问题. 完成任务情况 杜世康:弹幕的爬取 刘丹,李玉莹:系统统计功能实现 曹莹雯,尹楠: 主播管理功能实现 王静雅 :团队编码规范说明与本次博文撰写 遇到的问题 在爬 ...
- Alpha冲刺——day3
Alpha冲刺--day3 作业链接 Alpha冲刺随笔集 github地址 团队成员 031602636 许舒玲(队长) 031602237 吴杰婷 031602220 雷博浩 031602634 ...
- Alpha 冲刺四
团队成员 051601135 岳冠宇 051604103 陈思孝 031602629 刘意晗 031602248 郑智文 031602234 王淇 会议照片 项目燃尽图 项目进展 实现后端聊天接收,搜 ...