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. PHP完美分页类

    <?php /** file: page.class.php 完美分页类 Page */ class Page { private $total; //数据表中总记录数 private $lis ...

  2. PAT甲题题解-1109. Group Photo (25)-(模拟拍照排队)

    题意:n个人,要拍成k行排队,每行 n/k人,多余的都在最后一排. 从第一排到最后一排个子是逐渐增高的,即后一排最低的个子要>=前一排的所有人 每排排列规则如下: 1.中间m/2+1为该排最高: ...

  3. 2017中国人工智能公司榜单发布,颠覆AT的AI独角兽全在这

    每年12月,创业邦研究中心评选并报道“中国创新成长企业100强”,这个榜单我们已经连续做了8年,是中国最有潜力的创业新贵榜,受到了业内广泛认可.从2015年开始我们发现,人工智能上榜企业明显增多,20 ...

  4. 11.5 Daily Scrum

    请把现在当成11月5日······   Today's tasks  Tomorrow's tasks 丁辛 餐厅列表数据结构设计 餐厅列表UI设计             李承晗           ...

  5. Beta任务项录入

    今天PM把任务项整理写入TFS中,明天开始正式开发工作:

  6. jqgrid查找

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletExcepti ...

  7. Fast R-CNN论文阅读笔记

    论文地址:Fast R-CNN R-CNN的缺陷 (1)训练是一个多级的流水线.R-CNN首先在候选目标上微调一个卷积神经网络,使用log loss.然后使用SVMs充当目标分类器,以取代softma ...

  8. 以webService为客户端获取List泛型结果集

    首先搭建好webService,添加XFire1.2Core Libraries 和XFire1.2HTTP Client Libraries,连接上数据库,下例以oracle为数据库. 连接Oral ...

  9. 在vue中使用weixin-js-sdk自定义微信分享效果

    在做微信分享的时候,产品要求分享效果要有文字和图片,使用weixin-js-sdk解决了, 原始的分享效果: 使用微信JS-SDK的分享效果: 首先需要引入weixin-js-sdk npm inst ...

  10. maven基础知识汇总

    maven的dependency中scope=compile和provided的区别 对于scope=compile的情况(默认scope),也就是说这个项目在编译,测试,运行阶段都需要这个artif ...