├── DemoSketch ├── Demo1.png └── Demo2.png ├── Demo ├── MLImagePickerController │ ├── Assets.xcassets │ │ ├── Contents.json │ │ ├── zl_icon_image_no.imageset │ │ │ ├── zl_icon_image_no@2x.png │ │ │ ├── zl_icon_image_no@3x.png │ │ │ └── Contents.json │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── MLImagePickerController │ │ └── Classes │ │ │ ├── MLImagePickerController.bundle │ │ │ ├── zl_star@2x.png │ │ │ ├── zl_camera@2x.png │ │ │ ├── zl_video-play@2x.png │ │ │ ├── zl_video-play@3x.png │ │ │ ├── zl_icon_image_no@2x.png │ │ │ ├── zl_icon_image_no@3x.png │ │ │ ├── zl_icon_image_yes@2x.png │ │ │ ├── zl_icon_image_yes@3x.png │ │ │ ├── zl_xialajiantou@2x.png │ │ │ └── zl_xialajiantou@3x.png │ │ │ ├── Extension │ │ │ ├── ML+UIImageExtension.swift │ │ │ ├── ML+UIViewExtension.swift │ │ │ └── MBIBDesignableExtension.swift │ │ │ ├── ViewController │ │ │ ├── MLImageBrowserViewController.swift │ │ │ └── MLImagePickerQuickView.swift │ │ │ ├── View │ │ │ ├── MLImagePickerGroupCell.swift │ │ │ ├── MLImagePickerAssetsCell.swift │ │ │ ├── MLImagePickerAssetsCell.xib │ │ │ └── MLImagePickerGroupCell.xib │ │ │ └── Model │ │ │ └── MLImagePickerAssetsManger.swift │ ├── AppDelegate.swift │ ├── Info.plist │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ └── ViewController.swift └── MLImagePickerController.xcodeproj │ └── project.xcworkspace │ └── contents.xcworkspacedata ├── Swift2.0+ └── MLImagePickerController-master │ ├── Demo │ ├── MLImagePickerController │ │ ├── Assets.xcassets │ │ │ ├── Contents.json │ │ │ ├── zl_icon_image_no.imageset │ │ │ │ ├── zl_icon_image_no@2x.png │ │ │ │ ├── zl_icon_image_no@3x.png │ │ │ │ └── Contents.json │ │ │ └── AppIcon.appiconset │ │ │ │ └── Contents.json │ │ ├── MLImagePickerController │ │ │ └── Classes │ │ │ │ ├── MLImagePickerController.bundle │ │ │ │ ├── zl_star@2x.png │ │ │ │ ├── zl_camera@2x.png │ │ │ │ ├── zl_video-play@2x.png │ │ │ │ ├── zl_video-play@3x.png │ │ │ │ ├── zl_icon_image_no@2x.png │ │ │ │ ├── zl_icon_image_no@3x.png │ │ │ │ ├── zl_xialajiantou@2x.png │ │ │ │ ├── zl_xialajiantou@3x.png │ │ │ │ ├── zl_icon_image_yes@2x.png │ │ │ │ └── zl_icon_image_yes@3x.png │ │ │ │ ├── Extension │ │ │ │ ├── ML+UIImageExtension.swift │ │ │ │ ├── ML+UIViewExtension.swift │ │ │ │ └── MBIBDesignableExtension.swift │ │ │ │ ├── ViewController │ │ │ │ ├── MLImageBrowserViewController.swift │ │ │ │ └── MLImagePickerQuickView.swift │ │ │ │ ├── View │ │ │ │ ├── MLImagePickerGroupCell.swift │ │ │ │ ├── MLImagePickerAssetsCell.swift │ │ │ │ ├── MLImagePickerAssetsCell.xib │ │ │ │ └── MLImagePickerGroupCell.xib │ │ │ │ └── Model │ │ │ │ └── MLImagePickerAssetsManger.swift │ │ ├── AppDelegate.swift │ │ ├── Info.plist │ │ ├── Base.lproj │ │ │ ├── LaunchScreen.storyboard │ │ │ └── Main.storyboard │ │ └── ViewController.swift │ └── MLImagePickerController.xcodeproj │ │ ├── project.xcworkspace │ │ └── contents.xcworkspacedata │ │ └── project.pbxproj │ ├── DemoSketch │ ├── Demo1.png │ └── Demo2.png │ ├── MLImagePickerController │ └── Classes │ │ ├── MLImagePickerController.bundle │ │ ├── zl_video-play@2x.png │ │ ├── zl_video-play@3x.png │ │ ├── zl_icon_image_no@2x.png │ │ ├── zl_icon_image_no@3x.png │ │ ├── zl_icon_image_yes@2x.png │ │ └── zl_icon_image_yes@3x.png │ │ ├── View │ │ ├── MLImagePickerGroupCell.swift │ │ ├── MLImagePickerAssetsCell.swift │ │ ├── MLImagePickerAssetsCell.xib │ │ └── MLImagePickerGroupCell.xib │ │ ├── Extension │ │ ├── UIImage+Extension.swift │ │ └── MBIBDesignableExtension.swift │ │ └── ViewController │ │ └── MLImagePickerController.swift │ ├── README.md │ ├── LICENSE │ ├── MLImagePickerController.podspec │ └── .gitignore ├── MLImagePickerController └── Classes │ ├── MLImagePickerController.bundle │ ├── zl_video-play@2x.png │ ├── zl_video-play@3x.png │ ├── zl_icon_image_no@2x.png │ ├── zl_icon_image_no@3x.png │ ├── zl_icon_image_yes@2x.png │ └── zl_icon_image_yes@3x.png │ ├── View │ ├── MLImagePickerGroupCell.swift │ ├── MLImagePickerAssetsCell.swift │ ├── MLImagePickerAssetsCell.xib │ └── MLImagePickerGroupCell.xib │ ├── Extension │ ├── UIImage+Extension.swift │ └── MBIBDesignableExtension.swift │ └── ViewController │ └── MLImagePickerController.swift ├── README.md ├── LICENSE ├── MLImagePickerController.podspec └── .gitignore /DemoSketch/Demo1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MakeZL/MLImagePickerController/HEAD/DemoSketch/Demo1.png -------------------------------------------------------------------------------- /DemoSketch/Demo2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MakeZL/MLImagePickerController/HEAD/DemoSketch/Demo2.png -------------------------------------------------------------------------------- /Demo/MLImagePickerController/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Swift2.0+/MLImagePickerController-master/Demo/MLImagePickerController/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Swift2.0+/MLImagePickerController-master/DemoSketch/Demo1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MakeZL/MLImagePickerController/HEAD/Swift2.0+/MLImagePickerController-master/DemoSketch/Demo1.png -------------------------------------------------------------------------------- /Swift2.0+/MLImagePickerController-master/DemoSketch/Demo2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MakeZL/MLImagePickerController/HEAD/Swift2.0+/MLImagePickerController-master/DemoSketch/Demo2.png -------------------------------------------------------------------------------- /MLImagePickerController/Classes/MLImagePickerController.bundle/zl_video-play@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MakeZL/MLImagePickerController/HEAD/MLImagePickerController/Classes/MLImagePickerController.bundle/zl_video-play@2x.png -------------------------------------------------------------------------------- /MLImagePickerController/Classes/MLImagePickerController.bundle/zl_video-play@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MakeZL/MLImagePickerController/HEAD/MLImagePickerController/Classes/MLImagePickerController.bundle/zl_video-play@3x.png -------------------------------------------------------------------------------- /MLImagePickerController/Classes/MLImagePickerController.bundle/zl_icon_image_no@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MakeZL/MLImagePickerController/HEAD/MLImagePickerController/Classes/MLImagePickerController.bundle/zl_icon_image_no@2x.png -------------------------------------------------------------------------------- /MLImagePickerController/Classes/MLImagePickerController.bundle/zl_icon_image_no@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MakeZL/MLImagePickerController/HEAD/MLImagePickerController/Classes/MLImagePickerController.bundle/zl_icon_image_no@3x.png -------------------------------------------------------------------------------- /MLImagePickerController/Classes/MLImagePickerController.bundle/zl_icon_image_yes@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MakeZL/MLImagePickerController/HEAD/MLImagePickerController/Classes/MLImagePickerController.bundle/zl_icon_image_yes@2x.png -------------------------------------------------------------------------------- /MLImagePickerController/Classes/MLImagePickerController.bundle/zl_icon_image_yes@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MakeZL/MLImagePickerController/HEAD/MLImagePickerController/Classes/MLImagePickerController.bundle/zl_icon_image_yes@3x.png -------------------------------------------------------------------------------- /Demo/MLImagePickerController/Assets.xcassets/zl_icon_image_no.imageset/zl_icon_image_no@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MakeZL/MLImagePickerController/HEAD/Demo/MLImagePickerController/Assets.xcassets/zl_icon_image_no.imageset/zl_icon_image_no@2x.png -------------------------------------------------------------------------------- /Demo/MLImagePickerController/Assets.xcassets/zl_icon_image_no.imageset/zl_icon_image_no@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MakeZL/MLImagePickerController/HEAD/Demo/MLImagePickerController/Assets.xcassets/zl_icon_image_no.imageset/zl_icon_image_no@3x.png -------------------------------------------------------------------------------- /Demo/MLImagePickerController/MLImagePickerController/Classes/MLImagePickerController.bundle/zl_star@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MakeZL/MLImagePickerController/HEAD/Demo/MLImagePickerController/MLImagePickerController/Classes/MLImagePickerController.bundle/zl_star@2x.png -------------------------------------------------------------------------------- /Demo/MLImagePickerController.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Demo/MLImagePickerController/MLImagePickerController/Classes/MLImagePickerController.bundle/zl_camera@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MakeZL/MLImagePickerController/HEAD/Demo/MLImagePickerController/MLImagePickerController/Classes/MLImagePickerController.bundle/zl_camera@2x.png -------------------------------------------------------------------------------- /Demo/MLImagePickerController/MLImagePickerController/Classes/MLImagePickerController.bundle/zl_video-play@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MakeZL/MLImagePickerController/HEAD/Demo/MLImagePickerController/MLImagePickerController/Classes/MLImagePickerController.bundle/zl_video-play@2x.png -------------------------------------------------------------------------------- /Demo/MLImagePickerController/MLImagePickerController/Classes/MLImagePickerController.bundle/zl_video-play@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MakeZL/MLImagePickerController/HEAD/Demo/MLImagePickerController/MLImagePickerController/Classes/MLImagePickerController.bundle/zl_video-play@3x.png -------------------------------------------------------------------------------- /Demo/MLImagePickerController/MLImagePickerController/Classes/MLImagePickerController.bundle/zl_icon_image_no@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MakeZL/MLImagePickerController/HEAD/Demo/MLImagePickerController/MLImagePickerController/Classes/MLImagePickerController.bundle/zl_icon_image_no@2x.png -------------------------------------------------------------------------------- /Demo/MLImagePickerController/MLImagePickerController/Classes/MLImagePickerController.bundle/zl_icon_image_no@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MakeZL/MLImagePickerController/HEAD/Demo/MLImagePickerController/MLImagePickerController/Classes/MLImagePickerController.bundle/zl_icon_image_no@3x.png -------------------------------------------------------------------------------- /Demo/MLImagePickerController/MLImagePickerController/Classes/MLImagePickerController.bundle/zl_icon_image_yes@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MakeZL/MLImagePickerController/HEAD/Demo/MLImagePickerController/MLImagePickerController/Classes/MLImagePickerController.bundle/zl_icon_image_yes@2x.png -------------------------------------------------------------------------------- /Demo/MLImagePickerController/MLImagePickerController/Classes/MLImagePickerController.bundle/zl_icon_image_yes@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MakeZL/MLImagePickerController/HEAD/Demo/MLImagePickerController/MLImagePickerController/Classes/MLImagePickerController.bundle/zl_icon_image_yes@3x.png -------------------------------------------------------------------------------- /Demo/MLImagePickerController/MLImagePickerController/Classes/MLImagePickerController.bundle/zl_xialajiantou@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MakeZL/MLImagePickerController/HEAD/Demo/MLImagePickerController/MLImagePickerController/Classes/MLImagePickerController.bundle/zl_xialajiantou@2x.png -------------------------------------------------------------------------------- /Demo/MLImagePickerController/MLImagePickerController/Classes/MLImagePickerController.bundle/zl_xialajiantou@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MakeZL/MLImagePickerController/HEAD/Demo/MLImagePickerController/MLImagePickerController/Classes/MLImagePickerController.bundle/zl_xialajiantou@3x.png -------------------------------------------------------------------------------- /Swift2.0+/MLImagePickerController-master/MLImagePickerController/Classes/MLImagePickerController.bundle/zl_video-play@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MakeZL/MLImagePickerController/HEAD/Swift2.0+/MLImagePickerController-master/MLImagePickerController/Classes/MLImagePickerController.bundle/zl_video-play@2x.png -------------------------------------------------------------------------------- /Swift2.0+/MLImagePickerController-master/MLImagePickerController/Classes/MLImagePickerController.bundle/zl_video-play@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MakeZL/MLImagePickerController/HEAD/Swift2.0+/MLImagePickerController-master/MLImagePickerController/Classes/MLImagePickerController.bundle/zl_video-play@3x.png -------------------------------------------------------------------------------- /Swift2.0+/MLImagePickerController-master/Demo/MLImagePickerController.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Swift2.0+/MLImagePickerController-master/MLImagePickerController/Classes/MLImagePickerController.bundle/zl_icon_image_no@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MakeZL/MLImagePickerController/HEAD/Swift2.0+/MLImagePickerController-master/MLImagePickerController/Classes/MLImagePickerController.bundle/zl_icon_image_no@2x.png -------------------------------------------------------------------------------- /Swift2.0+/MLImagePickerController-master/MLImagePickerController/Classes/MLImagePickerController.bundle/zl_icon_image_no@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MakeZL/MLImagePickerController/HEAD/Swift2.0+/MLImagePickerController-master/MLImagePickerController/Classes/MLImagePickerController.bundle/zl_icon_image_no@3x.png -------------------------------------------------------------------------------- /Swift2.0+/MLImagePickerController-master/MLImagePickerController/Classes/MLImagePickerController.bundle/zl_icon_image_yes@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MakeZL/MLImagePickerController/HEAD/Swift2.0+/MLImagePickerController-master/MLImagePickerController/Classes/MLImagePickerController.bundle/zl_icon_image_yes@2x.png -------------------------------------------------------------------------------- /Swift2.0+/MLImagePickerController-master/MLImagePickerController/Classes/MLImagePickerController.bundle/zl_icon_image_yes@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MakeZL/MLImagePickerController/HEAD/Swift2.0+/MLImagePickerController-master/MLImagePickerController/Classes/MLImagePickerController.bundle/zl_icon_image_yes@3x.png -------------------------------------------------------------------------------- /Swift2.0+/MLImagePickerController-master/Demo/MLImagePickerController/Assets.xcassets/zl_icon_image_no.imageset/zl_icon_image_no@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MakeZL/MLImagePickerController/HEAD/Swift2.0+/MLImagePickerController-master/Demo/MLImagePickerController/Assets.xcassets/zl_icon_image_no.imageset/zl_icon_image_no@2x.png -------------------------------------------------------------------------------- /Swift2.0+/MLImagePickerController-master/Demo/MLImagePickerController/Assets.xcassets/zl_icon_image_no.imageset/zl_icon_image_no@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MakeZL/MLImagePickerController/HEAD/Swift2.0+/MLImagePickerController-master/Demo/MLImagePickerController/Assets.xcassets/zl_icon_image_no.imageset/zl_icon_image_no@3x.png -------------------------------------------------------------------------------- /Swift2.0+/MLImagePickerController-master/Demo/MLImagePickerController/MLImagePickerController/Classes/MLImagePickerController.bundle/zl_star@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MakeZL/MLImagePickerController/HEAD/Swift2.0+/MLImagePickerController-master/Demo/MLImagePickerController/MLImagePickerController/Classes/MLImagePickerController.bundle/zl_star@2x.png -------------------------------------------------------------------------------- /Swift2.0+/MLImagePickerController-master/Demo/MLImagePickerController/MLImagePickerController/Classes/MLImagePickerController.bundle/zl_camera@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MakeZL/MLImagePickerController/HEAD/Swift2.0+/MLImagePickerController-master/Demo/MLImagePickerController/MLImagePickerController/Classes/MLImagePickerController.bundle/zl_camera@2x.png -------------------------------------------------------------------------------- /Swift2.0+/MLImagePickerController-master/Demo/MLImagePickerController/MLImagePickerController/Classes/MLImagePickerController.bundle/zl_video-play@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MakeZL/MLImagePickerController/HEAD/Swift2.0+/MLImagePickerController-master/Demo/MLImagePickerController/MLImagePickerController/Classes/MLImagePickerController.bundle/zl_video-play@2x.png -------------------------------------------------------------------------------- /Swift2.0+/MLImagePickerController-master/Demo/MLImagePickerController/MLImagePickerController/Classes/MLImagePickerController.bundle/zl_video-play@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MakeZL/MLImagePickerController/HEAD/Swift2.0+/MLImagePickerController-master/Demo/MLImagePickerController/MLImagePickerController/Classes/MLImagePickerController.bundle/zl_video-play@3x.png -------------------------------------------------------------------------------- /Swift2.0+/MLImagePickerController-master/Demo/MLImagePickerController/MLImagePickerController/Classes/MLImagePickerController.bundle/zl_icon_image_no@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MakeZL/MLImagePickerController/HEAD/Swift2.0+/MLImagePickerController-master/Demo/MLImagePickerController/MLImagePickerController/Classes/MLImagePickerController.bundle/zl_icon_image_no@2x.png -------------------------------------------------------------------------------- /Swift2.0+/MLImagePickerController-master/Demo/MLImagePickerController/MLImagePickerController/Classes/MLImagePickerController.bundle/zl_icon_image_no@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MakeZL/MLImagePickerController/HEAD/Swift2.0+/MLImagePickerController-master/Demo/MLImagePickerController/MLImagePickerController/Classes/MLImagePickerController.bundle/zl_icon_image_no@3x.png -------------------------------------------------------------------------------- /Swift2.0+/MLImagePickerController-master/Demo/MLImagePickerController/MLImagePickerController/Classes/MLImagePickerController.bundle/zl_xialajiantou@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MakeZL/MLImagePickerController/HEAD/Swift2.0+/MLImagePickerController-master/Demo/MLImagePickerController/MLImagePickerController/Classes/MLImagePickerController.bundle/zl_xialajiantou@2x.png -------------------------------------------------------------------------------- /Swift2.0+/MLImagePickerController-master/Demo/MLImagePickerController/MLImagePickerController/Classes/MLImagePickerController.bundle/zl_xialajiantou@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MakeZL/MLImagePickerController/HEAD/Swift2.0+/MLImagePickerController-master/Demo/MLImagePickerController/MLImagePickerController/Classes/MLImagePickerController.bundle/zl_xialajiantou@3x.png -------------------------------------------------------------------------------- /Swift2.0+/MLImagePickerController-master/Demo/MLImagePickerController/MLImagePickerController/Classes/MLImagePickerController.bundle/zl_icon_image_yes@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MakeZL/MLImagePickerController/HEAD/Swift2.0+/MLImagePickerController-master/Demo/MLImagePickerController/MLImagePickerController/Classes/MLImagePickerController.bundle/zl_icon_image_yes@2x.png -------------------------------------------------------------------------------- /Swift2.0+/MLImagePickerController-master/Demo/MLImagePickerController/MLImagePickerController/Classes/MLImagePickerController.bundle/zl_icon_image_yes@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MakeZL/MLImagePickerController/HEAD/Swift2.0+/MLImagePickerController-master/Demo/MLImagePickerController/MLImagePickerController/Classes/MLImagePickerController.bundle/zl_icon_image_yes@3x.png -------------------------------------------------------------------------------- /MLImagePickerController/Classes/View/MLImagePickerGroupCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MLImagePickerGroupCell.swift 3 | // MLImagePickerController 4 | // 5 | // Created by zhanglei on 16/3/15. 6 | // Copyright © 2016年 zhanglei. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class MLImagePickerGroupCell: UITableViewCell { 12 | 13 | @IBOutlet weak var assetCountLbl: UILabel! 14 | @IBOutlet weak var titleLbl: UILabel! 15 | } 16 | -------------------------------------------------------------------------------- /Demo/MLImagePickerController/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // MLImagePickerController 4 | // 5 | // Created by zhanglei on 16/3/14. 6 | // Copyright © 2016年 zhanglei. All rights reserved. 7 | // 8 | // issue: https://github.com/MakeZL/MLImagePickerController/issues/new 9 | 10 | import UIKit 11 | 12 | @UIApplicationMain 13 | class AppDelegate: UIResponder, UIApplicationDelegate { 14 | var window: UIWindow? 15 | } 16 | 17 | -------------------------------------------------------------------------------- /Swift2.0+/MLImagePickerController-master/MLImagePickerController/Classes/View/MLImagePickerGroupCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MLImagePickerGroupCell.swift 3 | // MLImagePickerController 4 | // 5 | // Created by zhanglei on 16/3/15. 6 | // Copyright © 2016年 zhanglei. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class MLImagePickerGroupCell: UITableViewCell { 12 | 13 | @IBOutlet weak var assetCountLbl: UILabel! 14 | @IBOutlet weak var titleLbl: UILabel! 15 | } 16 | -------------------------------------------------------------------------------- /Swift2.0+/MLImagePickerController-master/Demo/MLImagePickerController/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // MLImagePickerController 4 | // 5 | // Created by zhanglei on 16/3/14. 6 | // Copyright © 2016年 zhanglei. All rights reserved. 7 | // 8 | // issue: https://github.com/MakeZL/MLImagePickerController/issues/new 9 | 10 | import UIKit 11 | 12 | @UIApplicationMain 13 | class AppDelegate: UIResponder, UIApplicationDelegate { 14 | var window: UIWindow? 15 | } 16 | 17 | -------------------------------------------------------------------------------- /MLImagePickerController/Classes/Extension/UIImage+Extension.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIImage+Extension.swift 3 | // MLImagePickerController 4 | // 5 | // Created by zhanglei on 16/3/15. 6 | // Copyright © 2016年 zhanglei. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ZLPhotoBundleClass: NSObject { 12 | func ml_imageFromBundleNamed(named:String)->UIImage{ 13 | return UIImage(named: "ZLPhotoLib.bundle".stringByAppendingString("/"+(named as String)))! 14 | } 15 | } 16 | 17 | -------------------------------------------------------------------------------- /Demo/MLImagePickerController/Assets.xcassets/zl_icon_image_no.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "zl_icon_image_no@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "zl_icon_image_no@3x.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /Swift2.0+/MLImagePickerController-master/MLImagePickerController/Classes/Extension/UIImage+Extension.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIImage+Extension.swift 3 | // MLImagePickerController 4 | // 5 | // Created by zhanglei on 16/3/15. 6 | // Copyright © 2016年 zhanglei. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ZLPhotoBundleClass: NSObject { 12 | func ml_imageFromBundleNamed(named:String)->UIImage{ 13 | return UIImage(named: "ZLPhotoLib.bundle".stringByAppendingString("/"+(named as String)))! 14 | } 15 | } 16 | 17 | -------------------------------------------------------------------------------- /Demo/MLImagePickerController/MLImagePickerController/Classes/Extension/ML+UIImageExtension.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ML+UIImageExtension.swift 3 | // MLImagePickerController 4 | // 5 | // Created by 张磊 on 16/3/27. 6 | // Copyright © 2016年 zhanglei. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | extension UIImage{ 12 | class func ml_imageFromBundleNamed(named:String)->UIImage{ 13 | let image = UIImage(named: "MLImagePickerController.bundle".appendingFormat("/"+(named as String)))! 14 | return image 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Demo/MLImagePickerController/MLImagePickerController/Classes/ViewController/MLImageBrowserViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MLImageBrowserViewController.swift 3 | // MLImagePickerController 4 | // 5 | // Created by zhanglei on 16/3/25. 6 | // Copyright © 2016年 zhanglei. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import PhotosUI 11 | 12 | class MLImageBrowserViewController: UIViewController { 13 | 14 | var asset:PHAsset! 15 | 16 | override func viewDidLoad() { 17 | super.viewDidLoad() 18 | 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /Swift2.0+/MLImagePickerController-master/Demo/MLImagePickerController/Assets.xcassets/zl_icon_image_no.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "zl_icon_image_no@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "zl_icon_image_no@3x.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /Swift2.0+/MLImagePickerController-master/Demo/MLImagePickerController/MLImagePickerController/Classes/Extension/ML+UIImageExtension.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ML+UIImageExtension.swift 3 | // MLImagePickerController 4 | // 5 | // Created by 张磊 on 16/3/27. 6 | // Copyright © 2016年 zhanglei. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | extension UIImage{ 12 | class func ml_imageFromBundleNamed(named:String)->UIImage{ 13 | let image = UIImage(named: "MLImagePickerController.bundle".stringByAppendingString("/"+(named as String)))! 14 | return image 15 | } 16 | } -------------------------------------------------------------------------------- /Swift2.0+/MLImagePickerController-master/Demo/MLImagePickerController/MLImagePickerController/Classes/ViewController/MLImageBrowserViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MLImageBrowserViewController.swift 3 | // MLImagePickerController 4 | // 5 | // Created by zhanglei on 16/3/25. 6 | // Copyright © 2016年 zhanglei. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import PhotosUI 11 | 12 | class MLImageBrowserViewController: UIViewController { 13 | 14 | var asset:PHAsset! 15 | 16 | override func viewDidLoad() { 17 | super.viewDidLoad() 18 | 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /Demo/MLImagePickerController/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /Demo/MLImagePickerController/MLImagePickerController/Classes/View/MLImagePickerGroupCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MLImagePickerGroupCell.swift 3 | // MLImagePickerController 4 | // 5 | // Created by zhanglei on 16/3/15. 6 | // Copyright © 2016年 zhanglei. All rights reserved. 7 | // 8 | // issue: https://github.com/MakeZL/MLImagePickerController/issues/new 9 | 10 | import UIKit 11 | 12 | class MLImagePickerGroupCell: UITableViewCell { 13 | 14 | @IBOutlet weak var assetCountLbl: UILabel! 15 | @IBOutlet weak var titleLbl: UILabel! 16 | @IBOutlet weak var selectedImgV: UIImageView! 17 | var selectedStatus:Bool! = false { 18 | didSet{ 19 | self.selectedImgV.isHidden = !self.selectedStatus 20 | self.selectedImgV.image = UIImage.ml_imageFromBundleNamed(named: "zl_star"); 21 | } 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /Swift2.0+/MLImagePickerController-master/Demo/MLImagePickerController/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /Swift2.0+/MLImagePickerController-master/Demo/MLImagePickerController/MLImagePickerController/Classes/View/MLImagePickerGroupCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MLImagePickerGroupCell.swift 3 | // MLImagePickerController 4 | // 5 | // Created by zhanglei on 16/3/15. 6 | // Copyright © 2016年 zhanglei. All rights reserved. 7 | // 8 | // issue: https://github.com/MakeZL/MLImagePickerController/issues/new 9 | 10 | import UIKit 11 | 12 | class MLImagePickerGroupCell: UITableViewCell { 13 | 14 | @IBOutlet weak var assetCountLbl: UILabel! 15 | @IBOutlet weak var titleLbl: UILabel! 16 | @IBOutlet weak var selectedImgV: UIImageView! 17 | var selectedStatus:Bool! = false { 18 | didSet{ 19 | self.selectedImgV.hidden = !self.selectedStatus 20 | self.selectedImgV.image = UIImage.ml_imageFromBundleNamed("zl_star"); 21 | } 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /Demo/MLImagePickerController/MLImagePickerController/Classes/Model/MLImagePickerAssetsManger.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MLImagePickerAssetsManger.swift 3 | // MLImagePickerController 4 | // 5 | // Created by 张磊 on 16/3/27. 6 | // Copyright © 2016年 zhanglei. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import PhotosUI 11 | 12 | class MLImagePickerAssetsManger: PHCachingImageManager { 13 | 14 | private var fetchResult:PHFetchResult! 15 | 16 | func result()->PHFetchResult{ 17 | if self.fetchResult != nil { 18 | return self.fetchResult 19 | } 20 | self.stopCachingImagesForAllAssets() 21 | 22 | let options:PHFetchOptions = PHFetchOptions() 23 | options.sortDescriptors = [NSSortDescriptor(key: "creationDate", ascending: false)] 24 | self.fetchResult = PHAsset.fetchAssets(with: options) 25 | 26 | return self.fetchResult 27 | 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Swift2.0+/MLImagePickerController-master/Demo/MLImagePickerController/MLImagePickerController/Classes/Model/MLImagePickerAssetsManger.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MLImagePickerAssetsManger.swift 3 | // MLImagePickerController 4 | // 5 | // Created by 张磊 on 16/3/27. 6 | // Copyright © 2016年 zhanglei. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import PhotosUI 11 | 12 | class MLImagePickerAssetsManger: PHCachingImageManager { 13 | 14 | private var fetchResult:PHFetchResult! 15 | 16 | func result()->PHFetchResult{ 17 | if self.fetchResult != nil { 18 | return self.fetchResult 19 | } 20 | self.stopCachingImagesForAllAssets() 21 | 22 | let options:PHFetchOptions = PHFetchOptions() 23 | options.sortDescriptors = [NSSortDescriptor(key: "creationDate", ascending: false)] 24 | self.fetchResult = PHAsset.fetchAssetsWithOptions(options) 25 | 26 | return self.fetchResult 27 | 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | MLImagePickerController 2 | ============== 3 | 4 | MLImagePickerController 使用Swift写的基于PhotoKit的简单易用的相册多选库. 5 | 6 | 演示项目 7 | ============== 8 | 9 |
10 | 11 | 12 | 13 | 安装 14 | ============== 15 | 16 | ### CocoaPods 17 | 18 | 1. 在 Podfile 中添加 `pod 'MLImagePickerController'`。 19 | 2. 执行 `pod install` 或 `pod update`。 20 | 21 | 22 | ### 手动安装 23 | 24 | 1. 下载 MLImagePickerController 文件夹内的所有内容。 25 | 2. 将 MLImagePickerController 内的源文件添加(拖放)到你的工程。 26 | 27 | 28 | 系统要求 29 | ============== 30 | 支持Swift3.0, 同时支持Swift2.0+ 31 | 该项目最低支持 `iOS 8.0` 和 `Xcode 7.0`。 32 | 33 | 关于问题 34 | ============== 35 | 你可以在 [点击](https://github.com/MakeZL/MLImagePickerController/issues/new) 提出任何问题,我会尽快做出修复或者解答 :) 36 | 37 | 许可证 38 | ============== 39 | MLImagePickerController 使用 MIT 许可证,详情见 LICENSE 文件。 40 | 41 | 42 | -------------------------------------------------------------------------------- /Swift2.0+/MLImagePickerController-master/README.md: -------------------------------------------------------------------------------- 1 | MLImagePickerController 2 | ============== 3 | 4 | MLImagePickerController 使用Swift写的基于PhotoKit的简单易用的相册多选库. 5 | 6 | 演示项目 7 | ============== 8 | 9 |
10 | 11 | 12 | 13 | 安装 14 | ============== 15 | 16 | ### CocoaPods 17 | 18 | 1. 在 Podfile 中添加 `pod 'MLImagePickerController'`。 19 | 2. 执行 `pod install` 或 `pod update`。 20 | 21 | 22 | ### 手动安装 23 | 24 | 1. 下载 MLImagePickerController 文件夹内的所有内容。 25 | 2. 将 MLImagePickerController 内的源文件添加(拖放)到你的工程。 26 | 27 | 28 | 系统要求 29 | ============== 30 | 该项目最低支持 `iOS 8.0` 和 `Xcode 7.0`。 31 | 32 | 关于问题 33 | ============== 34 | 你可以在 [点击](https://github.com/MakeZL/MLImagePickerController/issues/new) 提出任何问题,我会尽快做出修复或者解答 :) 35 | 36 | 许可证 37 | ============== 38 | MLImagePickerController 使用 MIT 许可证,详情见 LICENSE 文件。 39 | 40 | 41 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 MakeZL 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /MLImagePickerController.podspec: -------------------------------------------------------------------------------- 1 | 2 | Pod::Spec.new do |s| 3 | 4 | s.name = "MLImagePickerController" 5 | s.version = "0.3" 6 | s.summary = "MLImagePickerController Swift written using PhotoKit easy to use multi album Library Based on." 7 | 8 | s.description = <<-DESC 9 | The PhotoKit package, so that the use of more simple, provides more pictures, more video preview, fast and easy to use features 10 | DESC 11 | 12 | s.homepage = "https://github.com/MakeZL/MLImagePickerController" 13 | 14 | s.license = { :type => "MIT", :file => "LICENSE" } 15 | 16 | s.author = { "Leo" => "120886865@qq.com" } 17 | s.social_media_url = "http://weibo.com/MakeZL" 18 | 19 | s.platform = :ios, "8.0" 20 | s.ios.deployment_target = "8.0" 21 | 22 | s.source = { :git => "https://github.com/MakeZL/MLImagePickerController.git", :tag => s.version } 23 | 24 | s.source_files = "MLImagePickerController/**/*.swift" 25 | s.resource = "MLImagePickerController/Classes/MLImagePickerController.bundle" 26 | 27 | s.requires_arc = true 28 | s.framework = "Photos" 29 | 30 | end 31 | -------------------------------------------------------------------------------- /Swift2.0+/MLImagePickerController-master/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 MakeZL 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Swift2.0+/MLImagePickerController-master/MLImagePickerController.podspec: -------------------------------------------------------------------------------- 1 | 2 | Pod::Spec.new do |s| 3 | 4 | s.name = "MLImagePickerController" 5 | s.version = "0.3" 6 | s.summary = "MLImagePickerController Swift written using PhotoKit easy to use multi album Library Based on." 7 | 8 | s.description = <<-DESC 9 | The PhotoKit package, so that the use of more simple, provides more pictures, more video preview, fast and easy to use features 10 | DESC 11 | 12 | s.homepage = "https://github.com/MakeZL/MLImagePickerController" 13 | 14 | s.license = { :type => "MIT", :file => "LICENSE" } 15 | 16 | s.author = { "Leo" => "120886865@qq.com" } 17 | s.social_media_url = "http://weibo.com/MakeZL" 18 | 19 | s.platform = :ios, "8.0" 20 | s.ios.deployment_target = "8.0" 21 | 22 | s.source = { :git => "https://github.com/MakeZL/MLImagePickerController.git", :tag => s.version } 23 | 24 | s.source_files = "MLImagePickerController/**/*.swift" 25 | s.resource = "MLImagePickerController/Classes/MLImagePickerController.bundle" 26 | 27 | s.requires_arc = true 28 | s.framework = "Photos" 29 | 30 | end 31 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata 19 | 20 | ## Other 21 | *.xccheckout 22 | *.moved-aside 23 | *.xcuserstate 24 | *.xcscmblueprint 25 | 26 | ## Obj-C/Swift specific 27 | *.hmap 28 | *.ipa 29 | 30 | # CocoaPods 31 | # 32 | # We recommend against adding the Pods directory to your .gitignore. However 33 | # you should judge for yourself, the pros and cons are mentioned at: 34 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 35 | # 36 | # Pods/ 37 | 38 | # Carthage 39 | # 40 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 41 | # Carthage/Checkouts 42 | 43 | Carthage/Build 44 | 45 | # fastlane 46 | # 47 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 48 | # screenshots whenever they are needed. 49 | # For more information about the recommended setup visit: 50 | # https://github.com/fastlane/fastlane/blob/master/docs/Gitignore.md 51 | 52 | fastlane/report.xml 53 | fastlane/screenshots 54 | -------------------------------------------------------------------------------- /Swift2.0+/MLImagePickerController-master/.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata 19 | 20 | ## Other 21 | *.xccheckout 22 | *.moved-aside 23 | *.xcuserstate 24 | *.xcscmblueprint 25 | 26 | ## Obj-C/Swift specific 27 | *.hmap 28 | *.ipa 29 | 30 | # CocoaPods 31 | # 32 | # We recommend against adding the Pods directory to your .gitignore. However 33 | # you should judge for yourself, the pros and cons are mentioned at: 34 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 35 | # 36 | # Pods/ 37 | 38 | # Carthage 39 | # 40 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 41 | # Carthage/Checkouts 42 | 43 | Carthage/Build 44 | 45 | # fastlane 46 | # 47 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 48 | # screenshots whenever they are needed. 49 | # For more information about the recommended setup visit: 50 | # https://github.com/fastlane/fastlane/blob/master/docs/Gitignore.md 51 | 52 | fastlane/report.xml 53 | fastlane/screenshots 54 | -------------------------------------------------------------------------------- /Swift2.0+/MLImagePickerController-master/Demo/MLImagePickerController/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 0.3.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | NSCameraUsageDescription 40 | I need camera 41 | NSMicrophoneUsageDescription 42 | I need microphone 43 | 44 | 45 | -------------------------------------------------------------------------------- /Demo/MLImagePickerController/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 0.3.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | NSCameraUsageDescription 26 | I need camera 27 | NSMicrophoneUsageDescription 28 | I need microphone 29 | NSPhotoLibraryUsageDescription 30 | I need photo 31 | UILaunchStoryboardName 32 | LaunchScreen 33 | UIMainStoryboardFile 34 | Main 35 | UIRequiredDeviceCapabilities 36 | 37 | armv7 38 | 39 | UISupportedInterfaceOrientations 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationLandscapeLeft 43 | UIInterfaceOrientationLandscapeRight 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /Demo/MLImagePickerController/MLImagePickerController/Classes/Extension/ML+UIViewExtension.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ML+UIViewExtension.swift 3 | // MLImagePickerController 4 | // 5 | // Created by 张磊 on 16/3/27. 6 | // Copyright © 2016年 zhanglei. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | var messageLbl:UILabel! 12 | 13 | extension UIView{ 14 | func showWatting(str:String){ 15 | self.isUserInteractionEnabled = false 16 | 17 | let width:CGFloat = 180 18 | let height:CGFloat = 35 19 | let x:CGFloat = (self.frame.width - width) * 0.5 20 | let y:CGFloat = (self.frame.height - height) * 0.5 21 | 22 | let messageLblFrame = CGRect(x: 0,y: 0,width: width,height: height) 23 | 24 | if messageLbl != nil && (messageLbl.frame.equalTo(messageLblFrame) == true) { 25 | UIView.animate(withDuration: 0.35, animations: { () -> Void in 26 | messageLbl!.alpha = 1.0 27 | }) 28 | }else { 29 | messageLbl = UILabel(frame: CGRect(x: 0,y: 0,width: width,height: height)) 30 | messageLbl.layer.masksToBounds = true 31 | messageLbl.layer.cornerRadius = 5.0 32 | messageLbl.textAlignment = .center 33 | messageLbl.text = str 34 | messageLbl.backgroundColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0.5) 35 | messageLbl.textColor = UIColor.white 36 | self.addSubview(messageLbl) 37 | } 38 | } 39 | 40 | func hideWatting(){ 41 | self.isUserInteractionEnabled = true 42 | UIView.animate(withDuration: 0.35) { () -> Void in 43 | messageLbl.alpha = 0.0 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Swift2.0+/MLImagePickerController-master/Demo/MLImagePickerController/MLImagePickerController/Classes/Extension/ML+UIViewExtension.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ML+UIViewExtension.swift 3 | // MLImagePickerController 4 | // 5 | // Created by 张磊 on 16/3/27. 6 | // Copyright © 2016年 zhanglei. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | var messageLbl:UILabel! 12 | 13 | extension UIView{ 14 | func showWatting(str:String){ 15 | self.userInteractionEnabled = false 16 | 17 | let width:CGFloat = 180 18 | let height:CGFloat = 35 19 | let x:CGFloat = (self.frame.width - width) * 0.5 20 | let y:CGFloat = (self.frame.height - height) * 0.5 21 | 22 | let messageLblFrame = CGRectMake(x, y, width, height) 23 | if messageLbl != nil && (CGRectEqualToRect(messageLbl.frame, messageLblFrame) == true) { 24 | UIView.animateWithDuration(0.35, animations: { () -> Void in 25 | messageLbl!.alpha = 1.0 26 | }) 27 | }else { 28 | messageLbl = UILabel(frame: CGRectMake(x,y,width,height)) 29 | messageLbl.layer.masksToBounds = true 30 | messageLbl.layer.cornerRadius = 5.0 31 | messageLbl.textAlignment = .Center 32 | messageLbl.text = str 33 | messageLbl.backgroundColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0.5) 34 | messageLbl.textColor = UIColor.whiteColor() 35 | self.addSubview(messageLbl) 36 | } 37 | } 38 | 39 | func hideWatting(){ 40 | self.userInteractionEnabled = true 41 | UIView.animateWithDuration(0.35) { () -> Void in 42 | messageLbl.alpha = 0.0 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /Demo/MLImagePickerController/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Swift2.0+/MLImagePickerController-master/Demo/MLImagePickerController/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /MLImagePickerController/Classes/View/MLImagePickerAssetsCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MLImagePickerAssetsCell.swift 3 | // MLImagePickerController 4 | // 5 | // Created by zhanglei on 16/3/15. 6 | // Copyright © 2016年 zhanglei. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | protocol MLImagePickerAssetsCellDelegate { 12 | func imagePickerSelectAssetsCellWithSelected(indexPath:NSIndexPath,let selected:Bool); 13 | } 14 | 15 | class MLImagePickerAssetsCell: UICollectionViewCell { 16 | 17 | @IBOutlet weak var selectButton: UIButton! 18 | @IBOutlet weak var imageV: UIImageView! 19 | @IBOutlet weak var videoMaskImgV:UIImageView! 20 | 21 | var delegate:MLImagePickerAssetsCellDelegate? 22 | var localIdentifier:String! 23 | var indexPath:NSIndexPath! 24 | var isShowVideo:Bool!{ // Default is Hide 25 | didSet{ 26 | self.videoMaskImgV.hidden = !isShowVideo 27 | } 28 | } 29 | var selectButtonSelected:Bool! { 30 | didSet{ 31 | if self.selectButton.selected == selectButtonSelected { 32 | return 33 | } 34 | self.selectButton.selected = selectButtonSelected 35 | } 36 | } 37 | 38 | override func awakeFromNib() { 39 | super.awakeFromNib() 40 | 41 | let noImage = self.ml_imageFromBundleNamed("zl_icon_image_no") as UIImage 42 | let yesImage = self.ml_imageFromBundleNamed("zl_icon_image_yes") as UIImage 43 | 44 | self.videoMaskImgV.image = self.ml_imageFromBundleNamed("zl_video-play") as UIImage 45 | self.selectButton.setImage(noImage, forState: .Normal) 46 | self.selectButton.setImage(yesImage, forState: .Selected) 47 | } 48 | 49 | func ml_imageFromBundleNamed(named:String)->UIImage{ 50 | let image = UIImage(named: "ZLPhotoLib.bundle".stringByAppendingString("/"+(named as String)))! 51 | return image 52 | } 53 | 54 | @IBAction func selectPhoto() { 55 | 56 | self.selectButton.selected = !self.selectButton.selected 57 | if self.delegate != nil { 58 | self.delegate?.imagePickerSelectAssetsCellWithSelected(self.indexPath, selected: self.selectButton.selected) 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /Swift2.0+/MLImagePickerController-master/MLImagePickerController/Classes/View/MLImagePickerAssetsCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MLImagePickerAssetsCell.swift 3 | // MLImagePickerController 4 | // 5 | // Created by zhanglei on 16/3/15. 6 | // Copyright © 2016年 zhanglei. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | protocol MLImagePickerAssetsCellDelegate { 12 | func imagePickerSelectAssetsCellWithSelected(indexPath:NSIndexPath,let selected:Bool); 13 | } 14 | 15 | class MLImagePickerAssetsCell: UICollectionViewCell { 16 | 17 | @IBOutlet weak var selectButton: UIButton! 18 | @IBOutlet weak var imageV: UIImageView! 19 | @IBOutlet weak var videoMaskImgV:UIImageView! 20 | 21 | var delegate:MLImagePickerAssetsCellDelegate? 22 | var localIdentifier:String! 23 | var indexPath:NSIndexPath! 24 | var isShowVideo:Bool!{ // Default is Hide 25 | didSet{ 26 | self.videoMaskImgV.hidden = !isShowVideo 27 | } 28 | } 29 | var selectButtonSelected:Bool! { 30 | didSet{ 31 | if self.selectButton.selected == selectButtonSelected { 32 | return 33 | } 34 | self.selectButton.selected = selectButtonSelected 35 | } 36 | } 37 | 38 | override func awakeFromNib() { 39 | super.awakeFromNib() 40 | 41 | let noImage = self.ml_imageFromBundleNamed("zl_icon_image_no") as UIImage 42 | let yesImage = self.ml_imageFromBundleNamed("zl_icon_image_yes") as UIImage 43 | 44 | self.videoMaskImgV.image = self.ml_imageFromBundleNamed("zl_video-play") as UIImage 45 | self.selectButton.setImage(noImage, forState: .Normal) 46 | self.selectButton.setImage(yesImage, forState: .Selected) 47 | } 48 | 49 | func ml_imageFromBundleNamed(named:String)->UIImage{ 50 | let image = UIImage(named: "ZLPhotoLib.bundle".stringByAppendingString("/"+(named as String)))! 51 | return image 52 | } 53 | 54 | @IBAction func selectPhoto() { 55 | 56 | self.selectButton.selected = !self.selectButton.selected 57 | if self.delegate != nil { 58 | self.delegate?.imagePickerSelectAssetsCellWithSelected(self.indexPath, selected: self.selectButton.selected) 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /Demo/MLImagePickerController/MLImagePickerController/Classes/View/MLImagePickerAssetsCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MLImagePickerAssetsCell.swift 3 | // MLImagePickerController 4 | // 5 | // Created by zhanglei on 16/3/15. 6 | // Copyright © 2016年 zhanglei. All rights reserved. 7 | // 8 | // issue: https://github.com/MakeZL/MLImagePickerController/issues/new 9 | 10 | import UIKit 11 | import PhotosUI 12 | 13 | protocol MLImagePickerAssetsCellDelegate { 14 | func imagePickerSelectAssetsCellWithSelected(indexPath:IndexPath,selected:Bool) -> Bool; 15 | } 16 | 17 | class MLImagePickerAssetsCell: UICollectionViewCell { 18 | 19 | @IBOutlet weak var selectButton: UIButton! 20 | @IBOutlet weak var imageV: UIImageView! 21 | @IBOutlet weak var videoMaskImgV:UIImageView! 22 | 23 | var asset:PHAsset! 24 | var delegate:MLImagePickerAssetsCellDelegate? 25 | var localIdentifier:String! 26 | var indexPath:IndexPath! 27 | var isShowVideo:Bool!{ // Default is Hide 28 | didSet{ 29 | self.videoMaskImgV.isHidden = !isShowVideo 30 | } 31 | } 32 | var selectButtonSelected:Bool! { 33 | didSet{ 34 | if self.selectButton.isSelected == selectButtonSelected { 35 | return 36 | } 37 | self.selectButton.isSelected = selectButtonSelected 38 | } 39 | } 40 | 41 | override func awakeFromNib() { 42 | super.awakeFromNib() 43 | 44 | let noImage = UIImage.ml_imageFromBundleNamed(named: "zl_icon_image_no") as UIImage 45 | let yesImage = UIImage.ml_imageFromBundleNamed(named: "zl_icon_image_yes") as UIImage 46 | 47 | self.videoMaskImgV.image = UIImage.ml_imageFromBundleNamed(named: "zl_video-play") as UIImage 48 | self.selectButton.setImage(noImage, for: .normal) 49 | self.selectButton.setImage(yesImage, for: .selected) 50 | } 51 | 52 | @IBAction func selectPhoto() { 53 | if self.delegate != nil { 54 | let btnSelected = self.delegate?.imagePickerSelectAssetsCellWithSelected(indexPath: self.indexPath, selected: !self.selectButton.isSelected) 55 | if btnSelected == true { 56 | self.selectButton.isSelected = !self.selectButton.isSelected 57 | } 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /Swift2.0+/MLImagePickerController-master/Demo/MLImagePickerController/MLImagePickerController/Classes/View/MLImagePickerAssetsCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MLImagePickerAssetsCell.swift 3 | // MLImagePickerController 4 | // 5 | // Created by zhanglei on 16/3/15. 6 | // Copyright © 2016年 zhanglei. All rights reserved. 7 | // 8 | // issue: https://github.com/MakeZL/MLImagePickerController/issues/new 9 | 10 | import UIKit 11 | import PhotosUI 12 | 13 | protocol MLImagePickerAssetsCellDelegate { 14 | func imagePickerSelectAssetsCellWithSelected(indexPath:NSIndexPath,let selected:Bool) -> Bool; 15 | } 16 | 17 | class MLImagePickerAssetsCell: UICollectionViewCell { 18 | 19 | @IBOutlet weak var selectButton: UIButton! 20 | @IBOutlet weak var imageV: UIImageView! 21 | @IBOutlet weak var videoMaskImgV:UIImageView! 22 | 23 | var asset:PHAsset! 24 | var delegate:MLImagePickerAssetsCellDelegate? 25 | var localIdentifier:String! 26 | var indexPath:NSIndexPath! 27 | var isShowVideo:Bool!{ // Default is Hide 28 | didSet{ 29 | self.videoMaskImgV.hidden = !isShowVideo 30 | } 31 | } 32 | var selectButtonSelected:Bool! { 33 | didSet{ 34 | if self.selectButton.selected == selectButtonSelected { 35 | return 36 | } 37 | self.selectButton.selected = selectButtonSelected 38 | } 39 | } 40 | 41 | override func awakeFromNib() { 42 | super.awakeFromNib() 43 | 44 | let noImage = UIImage.ml_imageFromBundleNamed("zl_icon_image_no") as UIImage 45 | let yesImage = UIImage.ml_imageFromBundleNamed("zl_icon_image_yes") as UIImage 46 | 47 | self.videoMaskImgV.image = UIImage.ml_imageFromBundleNamed("zl_video-play") as UIImage 48 | self.selectButton.setImage(noImage, forState: .Normal) 49 | self.selectButton.setImage(yesImage, forState: .Selected) 50 | } 51 | 52 | @IBAction func selectPhoto() { 53 | if self.delegate != nil { 54 | let btnSelected = self.delegate?.imagePickerSelectAssetsCellWithSelected(self.indexPath, selected: !self.selectButton.selected) 55 | if btnSelected == true { 56 | self.selectButton.selected = !self.selectButton.selected 57 | } 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /Demo/MLImagePickerController/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // MLImagePickerController 4 | // 5 | // Created by zhanglei on 16/3/14. 6 | // Copyright © 2016年 zhanglei. All rights reserved. 7 | // 8 | // issue: https://github.com/MakeZL/MLImagePickerController/issues/new 9 | 10 | import UIKit 11 | import PhotosUI 12 | 13 | class ViewController: UIViewController, 14 | MLImagePickerControllerDelegate, 15 | UITableViewDataSource, 16 | UITableViewDelegate 17 | { 18 | 19 | @IBOutlet weak var tableView: UITableView! 20 | var assets:Array? = [] 21 | var assetIdentifiers:Array? = [] 22 | var phImageFileUrls:Array? = [] 23 | var quickView:MLImagePickerQuickView? 24 | 25 | override func viewDidLoad() { 26 | super.viewDidLoad() 27 | self.tableView.register(UITableViewCell.self, forCellReuseIdentifier: "cell") 28 | } 29 | 30 | // MARK: UITableViewDataSource 31 | func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 32 | return self.assets != nil ? self.assets!.count : 0 33 | } 34 | 35 | func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 36 | let cell = tableView.dequeueReusableCell(withIdentifier: "cell") 37 | cell?.imageView!.image = self.assets![indexPath.item] 38 | return cell! 39 | } 40 | 41 | /** 42 | CallBack 43 | 44 | - parameter assets: Array 45 | - parameter assetIdentifiers: Array 46 | */ 47 | func imagePickerDidSelectedAssets(assets: Array, assetIdentifiers: Array, phImageFileUrls: Array) { 48 | self.assets = assets 49 | self.assetIdentifiers = assetIdentifiers 50 | self.phImageFileUrls = phImageFileUrls 51 | self.tableView.reloadData() 52 | } 53 | 54 | /** 55 | * @IBAction 56 | */ 57 | @IBAction func selectPhoto() { 58 | let pickerVc = MLImagePickerController() 59 | // 回调 60 | pickerVc.delegate = self 61 | // 最大图片个数 62 | pickerVc.selectPickerMaxCount = 20 63 | // 默认记录选择的图片 64 | pickerVc.selectIndentifiers = self.assetIdentifiers! 65 | pickerVc.show(vc: self) 66 | } 67 | 68 | @IBAction func quick() { 69 | self.quickView?.removeFromSuperview() 70 | 71 | let quickView = MLImagePickerQuickView(frame: CGRect(x:0, y:self.view.frame.height - 250, width:self.view.frame.width, height:250)) 72 | quickView.delegate = self 73 | // 最大图片个数 74 | quickView.selectPickerMaxCount = 20 75 | // 默认记录选择的图片 76 | quickView.selectIndentifiers = self.assetIdentifiers 77 | // 如果不传的话,预览不能打开相册 78 | quickView.viewControllerReponse = self 79 | // 准备工作 80 | quickView.prepareForInterfaceBuilderAndData() 81 | self.view.addSubview(quickView) 82 | self.quickView = quickView 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /Swift2.0+/MLImagePickerController-master/Demo/MLImagePickerController/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // MLImagePickerController 4 | // 5 | // Created by zhanglei on 16/3/14. 6 | // Copyright © 2016年 zhanglei. All rights reserved. 7 | // 8 | // issue: https://github.com/MakeZL/MLImagePickerController/issues/new 9 | 10 | import UIKit 11 | import PhotosUI 12 | 13 | class ViewController: UIViewController, 14 | MLImagePickerControllerDelegate, 15 | UITableViewDataSource, 16 | UITableViewDelegate 17 | { 18 | 19 | @IBOutlet weak var tableView: UITableView! 20 | var assets:Array? = [] 21 | var assetIdentifiers:Array? = [] 22 | var phImageFileUrls:Array? = [] 23 | var quickView:MLImagePickerQuickView? 24 | 25 | override func viewDidLoad() { 26 | super.viewDidLoad() 27 | self.tableView.registerClass(UITableViewCell.self, forCellReuseIdentifier: "cell") 28 | } 29 | 30 | // MARK: UITableViewDataSource 31 | func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 32 | return self.assets != nil ? self.assets!.count : 0 33 | } 34 | 35 | func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { 36 | let cell = tableView.dequeueReusableCellWithIdentifier("cell") 37 | cell?.imageView!.image = self.assets![indexPath.item] 38 | return cell! 39 | } 40 | 41 | /** 42 | CallBack 43 | 44 | - parameter assets: Array 45 | - parameter assetIdentifiers: Array 46 | */ 47 | func imagePickerDidSelectedAssets(assets: Array, assetIdentifiers: Array, phImageFileUrls: Array) { 48 | self.assets = assets 49 | self.assetIdentifiers = assetIdentifiers 50 | self.phImageFileUrls = phImageFileUrls 51 | self.tableView.reloadData() 52 | } 53 | 54 | /** 55 | * @IBAction 56 | */ 57 | @IBAction func selectPhoto() { 58 | let pickerVc = MLImagePickerController() 59 | // 回调 60 | pickerVc.delegate = self 61 | // 最大图片个数 62 | pickerVc.selectPickerMaxCount = 20 63 | // 默认记录选择的图片 64 | pickerVc.selectIndentifiers = self.assetIdentifiers! 65 | pickerVc.show(self) 66 | } 67 | 68 | @IBAction func quick() { 69 | self.quickView?.removeFromSuperview() 70 | 71 | let quickView = MLImagePickerQuickView(frame: CGRectMake(0, self.view.frame.height - 250, self.view.frame.width, 250)) 72 | quickView.delegate = self 73 | // 最大图片个数 74 | quickView.selectPickerMaxCount = 20 75 | // 默认记录选择的图片 76 | quickView.selectIndentifiers = self.assetIdentifiers 77 | // 如果不传的话,预览不能打开相册 78 | quickView.viewControllerReponse = self 79 | // 准备工作 80 | quickView.prepareForInterfaceBuilderAndData() 81 | self.view.addSubview(quickView) 82 | self.quickView = quickView 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /MLImagePickerController/Classes/Extension/MBIBDesignableExtension.swift: -------------------------------------------------------------------------------- 1 | // github: https://github.com/MakeZL/UIView-Category 2 | // author: @email <120886865@qq.com> 3 | // 4 | // MBIBDesignableExtension.swift 5 | // IBDesignable 6 | // 7 | // Created by 张磊 on 15/4/29. 8 | // Copyright (c) 2015年 MakeZL. All rights reserved. 9 | // 10 | 11 | import UIKit 12 | 13 | extension UILabel{ 14 | @IBInspectable var textHexColor: NSString { 15 | get { 16 | return "0xffffff"; 17 | } 18 | set { 19 | let scanner = NSScanner(string: newValue as String) 20 | var hexNum = 0 as UInt32 21 | 22 | if (scanner.scanHexInt(&hexNum)){ 23 | let r = (hexNum >> 16) & 0xFF 24 | let g = (hexNum >> 8) & 0xFF 25 | let b = (hexNum) & 0xFF 26 | 27 | self.textColor = UIColor(red: CGFloat(r)/255.0, green: CGFloat(g)/255.0, blue: CGFloat(b)/255.0, alpha: 1.0) 28 | } 29 | } 30 | } 31 | } 32 | 33 | extension UIButton{ 34 | @IBInspectable var textHexColor: NSString { 35 | get { 36 | return "0xffffff"; 37 | } 38 | set { 39 | let scanner = NSScanner(string: newValue as String) 40 | var hexNum = 0 as UInt32 41 | 42 | if (scanner.scanHexInt(&hexNum)){ 43 | let r = (hexNum >> 16) & 0xFF 44 | let g = (hexNum >> 8) & 0xFF 45 | let b = (hexNum) & 0xFF 46 | 47 | self.setTitleColor(UIColor(red: CGFloat(r)/255.0, green: CGFloat(g)/255.0, blue: CGFloat(b)/255.0, alpha: 1.0), forState: .Normal) 48 | } 49 | } 50 | } 51 | } 52 | 53 | extension UIView{ 54 | @IBInspectable var cornerRadius: CGFloat { 55 | get { 56 | return layer.cornerRadius 57 | } 58 | set { 59 | layer.cornerRadius = newValue 60 | layer.masksToBounds = newValue > 0 61 | } 62 | } 63 | 64 | @IBInspectable var borderWidth: CGFloat { 65 | get { 66 | return layer.borderWidth 67 | } 68 | set { 69 | layer.borderWidth = newValue 70 | } 71 | } 72 | 73 | @IBInspectable var borderColor: UIColor { 74 | get { 75 | return UIColor(CGColor: layer.borderColor!) 76 | } 77 | set { 78 | layer.borderColor = newValue.CGColor 79 | } 80 | } 81 | 82 | @IBInspectable var hexRgbColor: NSString { 83 | get { 84 | return "0xffffff"; 85 | } 86 | set { 87 | 88 | let scanner = NSScanner(string: newValue as String) 89 | var hexNum = 0 as UInt32 90 | 91 | if (scanner.scanHexInt(&hexNum)){ 92 | let r = (hexNum >> 16) & 0xFF 93 | let g = (hexNum >> 8) & 0xFF 94 | let b = (hexNum) & 0xFF 95 | 96 | self.backgroundColor = UIColor(red: CGFloat(r)/255.0, green: CGFloat(g)/255.0, blue: CGFloat(b)/255.0, alpha: 1.0) 97 | } 98 | 99 | } 100 | } 101 | 102 | @IBInspectable var onePx: Bool { 103 | get { 104 | return true 105 | } 106 | set { 107 | if (onePx == true){ 108 | self.frame = CGRectMake(self.frame.origin.x, self.frame.origin.y, self.frame.size.width, 1 / UIScreen.mainScreen().scale) 109 | } 110 | } 111 | } 112 | } -------------------------------------------------------------------------------- /Demo/MLImagePickerController/MLImagePickerController/Classes/Extension/MBIBDesignableExtension.swift: -------------------------------------------------------------------------------- 1 | // github: https://github.com/MakeZL/UIView-Category 2 | // author: @email <120886865@qq.com> 3 | // 4 | // MBIBDesignableExtension.swift 5 | // IBDesignable 6 | // 7 | // Created by 张磊 on 15/4/29. 8 | // Copyright (c) 2015年 MakeZL. All rights reserved. 9 | // 10 | 11 | import UIKit 12 | 13 | extension UILabel{ 14 | @IBInspectable var textHexColor: NSString { 15 | get { 16 | return "0xffffff"; 17 | } 18 | set { 19 | let scanner = Scanner(string: newValue as String) 20 | var hexNum = 0 as UInt32 21 | 22 | if (scanner.scanHexInt32(&hexNum)){ 23 | let r = (hexNum >> 16) & 0xFF 24 | let g = (hexNum >> 8) & 0xFF 25 | let b = (hexNum) & 0xFF 26 | 27 | self.textColor = UIColor(red: CGFloat(r)/255.0, green: CGFloat(g)/255.0, blue: CGFloat(b)/255.0, alpha: 1.0) 28 | } 29 | } 30 | } 31 | } 32 | 33 | extension UIButton{ 34 | @IBInspectable var textHexColor: NSString { 35 | get { 36 | return "0xffffff"; 37 | } 38 | set { 39 | let scanner = Scanner(string: newValue as String) 40 | var hexNum = 0 as UInt32 41 | 42 | if (scanner.scanHexInt32(&hexNum)){ 43 | let r = (hexNum >> 16) & 0xFF 44 | let g = (hexNum >> 8) & 0xFF 45 | let b = (hexNum) & 0xFF 46 | 47 | self.setTitleColor(UIColor(red: CGFloat(r)/255.0, green: CGFloat(g)/255.0, blue: CGFloat(b)/255.0, alpha: 1.0), for: .normal) 48 | } 49 | } 50 | } 51 | } 52 | 53 | extension UIView{ 54 | @IBInspectable var cornerRadius: CGFloat { 55 | get { 56 | return layer.cornerRadius 57 | } 58 | set { 59 | layer.cornerRadius = newValue 60 | layer.masksToBounds = newValue > 0 61 | } 62 | } 63 | 64 | @IBInspectable var borderWidth: CGFloat { 65 | get { 66 | return layer.borderWidth 67 | } 68 | set { 69 | layer.borderWidth = newValue 70 | } 71 | } 72 | 73 | @IBInspectable var borderColor: UIColor { 74 | get { 75 | return UIColor(cgColor: layer.borderColor!) 76 | } 77 | set { 78 | layer.borderColor = newValue.cgColor 79 | } 80 | } 81 | 82 | @IBInspectable var hexRgbColor: NSString { 83 | get { 84 | return "0xffffff"; 85 | } 86 | set { 87 | 88 | let scanner = Scanner(string: newValue as String) 89 | var hexNum = 0 as UInt32 90 | 91 | if (scanner.scanHexInt32(&hexNum)){ 92 | let r = (hexNum >> 16) & 0xFF 93 | let g = (hexNum >> 8) & 0xFF 94 | let b = (hexNum) & 0xFF 95 | 96 | self.backgroundColor = UIColor(red: CGFloat(r)/255.0, green: CGFloat(g)/255.0, blue: CGFloat(b)/255.0, alpha: 1.0) 97 | } 98 | 99 | } 100 | } 101 | 102 | @IBInspectable var onePx: Bool { 103 | get { 104 | return true 105 | } 106 | set { 107 | if (onePx == true){ 108 | self.frame = CGRect(x:self.frame.origin.x, y:self.frame.origin.y, width:self.frame.size.width, height:1 / UIScreen.main.scale) 109 | } 110 | } 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /Swift2.0+/MLImagePickerController-master/MLImagePickerController/Classes/Extension/MBIBDesignableExtension.swift: -------------------------------------------------------------------------------- 1 | // github: https://github.com/MakeZL/UIView-Category 2 | // author: @email <120886865@qq.com> 3 | // 4 | // MBIBDesignableExtension.swift 5 | // IBDesignable 6 | // 7 | // Created by 张磊 on 15/4/29. 8 | // Copyright (c) 2015年 MakeZL. All rights reserved. 9 | // 10 | 11 | import UIKit 12 | 13 | extension UILabel{ 14 | @IBInspectable var textHexColor: NSString { 15 | get { 16 | return "0xffffff"; 17 | } 18 | set { 19 | let scanner = NSScanner(string: newValue as String) 20 | var hexNum = 0 as UInt32 21 | 22 | if (scanner.scanHexInt(&hexNum)){ 23 | let r = (hexNum >> 16) & 0xFF 24 | let g = (hexNum >> 8) & 0xFF 25 | let b = (hexNum) & 0xFF 26 | 27 | self.textColor = UIColor(red: CGFloat(r)/255.0, green: CGFloat(g)/255.0, blue: CGFloat(b)/255.0, alpha: 1.0) 28 | } 29 | } 30 | } 31 | } 32 | 33 | extension UIButton{ 34 | @IBInspectable var textHexColor: NSString { 35 | get { 36 | return "0xffffff"; 37 | } 38 | set { 39 | let scanner = NSScanner(string: newValue as String) 40 | var hexNum = 0 as UInt32 41 | 42 | if (scanner.scanHexInt(&hexNum)){ 43 | let r = (hexNum >> 16) & 0xFF 44 | let g = (hexNum >> 8) & 0xFF 45 | let b = (hexNum) & 0xFF 46 | 47 | self.setTitleColor(UIColor(red: CGFloat(r)/255.0, green: CGFloat(g)/255.0, blue: CGFloat(b)/255.0, alpha: 1.0), forState: .Normal) 48 | } 49 | } 50 | } 51 | } 52 | 53 | extension UIView{ 54 | @IBInspectable var cornerRadius: CGFloat { 55 | get { 56 | return layer.cornerRadius 57 | } 58 | set { 59 | layer.cornerRadius = newValue 60 | layer.masksToBounds = newValue > 0 61 | } 62 | } 63 | 64 | @IBInspectable var borderWidth: CGFloat { 65 | get { 66 | return layer.borderWidth 67 | } 68 | set { 69 | layer.borderWidth = newValue 70 | } 71 | } 72 | 73 | @IBInspectable var borderColor: UIColor { 74 | get { 75 | return UIColor(CGColor: layer.borderColor!) 76 | } 77 | set { 78 | layer.borderColor = newValue.CGColor 79 | } 80 | } 81 | 82 | @IBInspectable var hexRgbColor: NSString { 83 | get { 84 | return "0xffffff"; 85 | } 86 | set { 87 | 88 | let scanner = NSScanner(string: newValue as String) 89 | var hexNum = 0 as UInt32 90 | 91 | if (scanner.scanHexInt(&hexNum)){ 92 | let r = (hexNum >> 16) & 0xFF 93 | let g = (hexNum >> 8) & 0xFF 94 | let b = (hexNum) & 0xFF 95 | 96 | self.backgroundColor = UIColor(red: CGFloat(r)/255.0, green: CGFloat(g)/255.0, blue: CGFloat(b)/255.0, alpha: 1.0) 97 | } 98 | 99 | } 100 | } 101 | 102 | @IBInspectable var onePx: Bool { 103 | get { 104 | return true 105 | } 106 | set { 107 | if (onePx == true){ 108 | self.frame = CGRectMake(self.frame.origin.x, self.frame.origin.y, self.frame.size.width, 1 / UIScreen.mainScreen().scale) 109 | } 110 | } 111 | } 112 | } -------------------------------------------------------------------------------- /Swift2.0+/MLImagePickerController-master/Demo/MLImagePickerController/MLImagePickerController/Classes/Extension/MBIBDesignableExtension.swift: -------------------------------------------------------------------------------- 1 | // github: https://github.com/MakeZL/UIView-Category 2 | // author: @email <120886865@qq.com> 3 | // 4 | // MBIBDesignableExtension.swift 5 | // IBDesignable 6 | // 7 | // Created by 张磊 on 15/4/29. 8 | // Copyright (c) 2015年 MakeZL. All rights reserved. 9 | // 10 | 11 | import UIKit 12 | 13 | extension UILabel{ 14 | @IBInspectable var textHexColor: NSString { 15 | get { 16 | return "0xffffff"; 17 | } 18 | set { 19 | let scanner = NSScanner(string: newValue as String) 20 | var hexNum = 0 as UInt32 21 | 22 | if (scanner.scanHexInt(&hexNum)){ 23 | let r = (hexNum >> 16) & 0xFF 24 | let g = (hexNum >> 8) & 0xFF 25 | let b = (hexNum) & 0xFF 26 | 27 | self.textColor = UIColor(red: CGFloat(r)/255.0, green: CGFloat(g)/255.0, blue: CGFloat(b)/255.0, alpha: 1.0) 28 | } 29 | } 30 | } 31 | } 32 | 33 | extension UIButton{ 34 | @IBInspectable var textHexColor: NSString { 35 | get { 36 | return "0xffffff"; 37 | } 38 | set { 39 | let scanner = NSScanner(string: newValue as String) 40 | var hexNum = 0 as UInt32 41 | 42 | if (scanner.scanHexInt(&hexNum)){ 43 | let r = (hexNum >> 16) & 0xFF 44 | let g = (hexNum >> 8) & 0xFF 45 | let b = (hexNum) & 0xFF 46 | 47 | self.setTitleColor(UIColor(red: CGFloat(r)/255.0, green: CGFloat(g)/255.0, blue: CGFloat(b)/255.0, alpha: 1.0), forState: .Normal) 48 | } 49 | } 50 | } 51 | } 52 | 53 | extension UIView{ 54 | @IBInspectable var cornerRadius: CGFloat { 55 | get { 56 | return layer.cornerRadius 57 | } 58 | set { 59 | layer.cornerRadius = newValue 60 | layer.masksToBounds = newValue > 0 61 | } 62 | } 63 | 64 | @IBInspectable var borderWidth: CGFloat { 65 | get { 66 | return layer.borderWidth 67 | } 68 | set { 69 | layer.borderWidth = newValue 70 | } 71 | } 72 | 73 | @IBInspectable var borderColor: UIColor { 74 | get { 75 | return UIColor(CGColor: layer.borderColor!) 76 | } 77 | set { 78 | layer.borderColor = newValue.CGColor 79 | } 80 | } 81 | 82 | @IBInspectable var hexRgbColor: NSString { 83 | get { 84 | return "0xffffff"; 85 | } 86 | set { 87 | 88 | let scanner = NSScanner(string: newValue as String) 89 | var hexNum = 0 as UInt32 90 | 91 | if (scanner.scanHexInt(&hexNum)){ 92 | let r = (hexNum >> 16) & 0xFF 93 | let g = (hexNum >> 8) & 0xFF 94 | let b = (hexNum) & 0xFF 95 | 96 | self.backgroundColor = UIColor(red: CGFloat(r)/255.0, green: CGFloat(g)/255.0, blue: CGFloat(b)/255.0, alpha: 1.0) 97 | } 98 | 99 | } 100 | } 101 | 102 | @IBInspectable var onePx: Bool { 103 | get { 104 | return true 105 | } 106 | set { 107 | if (onePx == true){ 108 | self.frame = CGRectMake(self.frame.origin.x, self.frame.origin.y, self.frame.size.width, 1 / UIScreen.mainScreen().scale) 109 | } 110 | } 111 | } 112 | } -------------------------------------------------------------------------------- /MLImagePickerController/Classes/View/MLImagePickerAssetsCell.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 29 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /Swift2.0+/MLImagePickerController-master/MLImagePickerController/Classes/View/MLImagePickerAssetsCell.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 29 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /Demo/MLImagePickerController/MLImagePickerController/Classes/View/MLImagePickerAssetsCell.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 30 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /Swift2.0+/MLImagePickerController-master/Demo/MLImagePickerController/MLImagePickerController/Classes/View/MLImagePickerAssetsCell.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 30 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /MLImagePickerController/Classes/View/MLImagePickerGroupCell.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 24 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /Swift2.0+/MLImagePickerController-master/MLImagePickerController/Classes/View/MLImagePickerGroupCell.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 24 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /Demo/MLImagePickerController/MLImagePickerController/Classes/View/MLImagePickerGroupCell.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 24 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /Swift2.0+/MLImagePickerController-master/Demo/MLImagePickerController/MLImagePickerController/Classes/View/MLImagePickerGroupCell.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 24 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /Demo/MLImagePickerController/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 37 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /Swift2.0+/MLImagePickerController-master/Demo/MLImagePickerController/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 38 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /Demo/MLImagePickerController/MLImagePickerController/Classes/ViewController/MLImagePickerQuickView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MLImagePickerQuickView.swift 3 | // MLImagePickerController 4 | // 5 | // Created by 张磊 on 16/3/26. 6 | // Copyright © 2016年 zhanglei. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import PhotosUI 11 | 12 | let MLImagePickerMenuHeight:CGFloat = 40 13 | 14 | class MLImagePickerQuickView: UIView, 15 | UICollectionViewDataSource, 16 | UICollectionViewDelegate, 17 | UICollectionViewDelegateFlowLayout, 18 | MLImagePickerAssetsCellDelegate 19 | { 20 | 21 | 22 | private var fetchResult:PHFetchResult! 23 | private var imageManager:MLImagePickerAssetsManger! 24 | private var photoIdentifiers:Array = [] 25 | private var phImageFileUrls:Array! = [] 26 | private var selectImages:Array = [] 27 | private var listsImages:Array = [] 28 | 29 | private var collectionView:UICollectionView! 30 | private var redTagLbl:UILabel! 31 | private var messageLbl:UILabel! 32 | private var albumContainerView:UIView! 33 | 34 | // MARK: Public 35 | // , SelectAssets CallBack 36 | var delegate:MLImagePickerControllerDelegate? 37 | // Selected Indentifiers Assets 38 | var selectIndentifiers:Array! = [] 39 | // Setting Max Multiselect Count 40 | var selectPickerMaxCount:Int! = 9 41 | // Scroll Selecte Pickers, Default is YES 42 | var cancleLongGestureScrollSelectedPicker:Bool! = false 43 | // picker list count, Default is 50 44 | var showListsPickerCount:Int! = 50 45 | // if viewControllerReponse is nil, but not open album. 46 | var viewControllerReponse:UIViewController? 47 | 48 | // Must realize. 49 | func prepareForInterfaceBuilderAndData() { 50 | self.setupCollectionView() 51 | } 52 | 53 | func setupCollectionView(){ 54 | 55 | let albumContainerView:UIView = UIView(frame: CGRect(x:0, y:self.frame.height, width:self.frame.width, height:self.frame.height)) 56 | albumContainerView.backgroundColor = UIColor.white 57 | self.addSubview(albumContainerView) 58 | self.albumContainerView = albumContainerView 59 | 60 | let menuView:UIView = UIView() 61 | menuView.borderColor = UIColor(red: 231/256.0, green: 231/256.0, blue: 231/256.0, alpha: 1.0) 62 | menuView.borderWidth = 0.5 63 | menuView.frame = CGRect(x:0, y:0, width:self.frame.width, height:MLImagePickerMenuHeight) 64 | albumContainerView.addSubview(menuView) 65 | 66 | if self.viewControllerReponse != nil { 67 | let openAlbumBtn = UIButton(frame: CGRect(x:15, y:0, width:60, height:MLImagePickerMenuHeight)) 68 | openAlbumBtn.setTitleColor(UIColor(red: 49/256.0, green: 105/256.0, blue: 245/256.0, alpha: 1.0), for: .normal) 69 | openAlbumBtn.titleLabel?.font = UIFont.systemFont(ofSize: 14) 70 | openAlbumBtn.setTitle("打开相册", for: .normal) 71 | openAlbumBtn.addTarget(self, action: #selector(MLImagePickerQuickView.openAlbum), for: .touchUpInside) 72 | menuView.addSubview(openAlbumBtn) 73 | } 74 | 75 | let doneBtn = UIButton(frame: CGRect(x:self.frame.width - MLImagePickerMenuHeight - 15, y:0, width:MLImagePickerMenuHeight, height:MLImagePickerMenuHeight)) 76 | doneBtn.setTitleColor(UIColor(red: 49/256.0, green: 105/256.0, blue: 245/256.0, alpha: 1.0), for: .normal) 77 | doneBtn.titleLabel?.font = UIFont.systemFont(ofSize: 14) 78 | doneBtn.setTitle("完成", for: .normal) 79 | doneBtn.addTarget(self, action: #selector(MLImagePickerQuickView.done), for: .touchUpInside) 80 | menuView.addSubview(doneBtn) 81 | 82 | let redTagLbl = UILabel() 83 | redTagLbl.isHidden = (self.selectIndentifiers.count == 0) 84 | redTagLbl.text = "\(self.selectIndentifiers.count)" 85 | redTagLbl.layer.cornerRadius = 8.0 86 | redTagLbl.layer.masksToBounds = true 87 | redTagLbl.backgroundColor = UIColor.red 88 | redTagLbl.textColor = UIColor.white 89 | 90 | redTagLbl.font = UIFont.systemFont(ofSize: 12) 91 | redTagLbl.textAlignment = .center 92 | redTagLbl.frame = CGRect(x:doneBtn.frame.maxX-10,y:4, width:16, height:16) 93 | menuView.addSubview(redTagLbl) 94 | self.redTagLbl = redTagLbl 95 | 96 | let layout:UICollectionViewFlowLayout = UICollectionViewFlowLayout() 97 | layout.scrollDirection = .horizontal 98 | layout.minimumInteritemSpacing = 5 99 | layout.minimumLineSpacing = 0 100 | 101 | let collectionView:UICollectionView = UICollectionView(frame: CGRect(x:0, y:menuView.frame.maxY, width:self.frame.width, height:self.frame.height - MLImagePickerMenuHeight), collectionViewLayout: layout) 102 | collectionView.backgroundColor = UIColor.white 103 | collectionView.register(UINib(nibName: "MLImagePickerAssetsCell", bundle: nil), forCellWithReuseIdentifier: "MLImagePickerAssetsCell") 104 | collectionView.dataSource = self 105 | collectionView.delegate = self 106 | collectionView.showsHorizontalScrollIndicator = false 107 | collectionView.showsVerticalScrollIndicator = false 108 | 109 | albumContainerView.addSubview(collectionView) 110 | self.collectionView = collectionView 111 | 112 | self.imageManager = MLImagePickerAssetsManger() 113 | self.imageManager.stopCachingImagesForAllAssets() 114 | self.fetchResult = self.imageManager.result() 115 | 116 | let requestOptions = PHImageRequestOptions() 117 | requestOptions.deliveryMode = .highQualityFormat 118 | requestOptions.isNetworkAccessAllowed = true 119 | requestOptions.isSynchronous = true 120 | 121 | let count = self.fetchResult.count > 50 ? 50 : self.fetchResult.count 122 | 123 | for i in 0 ..< count { 124 | let asset:PHAsset = self.fetchResult[i] 125 | self.photoIdentifiers.append(asset.localIdentifier) 126 | 127 | self.imageManager.requestImage(for: asset, targetSize: CGSize(width:self.frame.height,height:self.frame.height), contentMode: .aspectFill, options: requestOptions) { (image, info) -> Void in 128 | self.listsImages.append(image!) 129 | 130 | if self.selectIndentifiers.contains(asset.localIdentifier) == true { 131 | self.selectImages.append(image!) 132 | if info![PHImageFileURLKey] != nil { 133 | self.phImageFileUrls.append(info![PHImageFileURLKey] as! NSURL) 134 | } 135 | self.selectImages.append(image!) 136 | } 137 | 138 | UIView.animate(withDuration: 0.25, animations: { () -> Void in 139 | self.albumContainerView.frame = self.bounds 140 | }) 141 | 142 | self.collectionView?.reloadData() 143 | self.collectionView?.layoutIfNeeded() 144 | } 145 | 146 | } 147 | } 148 | 149 | private func numberOfSectionsInCollectionView(collectionView: UICollectionView) -> Int { 150 | return 1 151 | } 152 | 153 | func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { 154 | return self.listsImages.count 155 | } 156 | 157 | public func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { 158 | let cell:MLImagePickerAssetsCell = collectionView.dequeueReusableCell(withReuseIdentifier: "MLImagePickerAssetsCell", for: indexPath as IndexPath) as! MLImagePickerAssetsCell 159 | 160 | let asset:PHAsset = self.fetchResult[indexPath.item] 161 | cell.delegate = self 162 | cell.asset = asset 163 | cell.indexPath = indexPath 164 | cell.localIdentifier = self.photoIdentifiers[indexPath.item] 165 | cell.selectButtonSelected = self.selectIndentifiers.contains(cell.localIdentifier) 166 | cell.isShowVideo = (asset.mediaType == .video) 167 | cell.imageV.image = self.listsImages[indexPath.item] 168 | 169 | return cell 170 | } 171 | 172 | func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { 173 | 174 | let image:UIImage = self.listsImages[indexPath.item] 175 | let radio:CGFloat = image.size.height / collectionView.frame.height 176 | 177 | return CGSize(width: image.size.width / radio, height: collectionView.frame.height) 178 | } 179 | 180 | // MARK: MLImagePickerAssetsCellDelegate 181 | func imagePickerSelectAssetsCellWithSelected(indexPath: IndexPath, selected: Bool) -> Bool { 182 | let identifier = self.photoIdentifiers[indexPath.item] 183 | let asset:PHAsset = self.fetchResult[indexPath.item] 184 | 185 | if selected == true { 186 | if (self.checkBeyondMaxSelectPickerCount() == false){ 187 | return false 188 | } 189 | if self.selectIndentifiers.contains(identifier) == false { 190 | // Insert 191 | self.selectIndentifiers.append(identifier) 192 | }else{ 193 | return false; 194 | } 195 | }else{ 196 | // Delete 197 | if selectIndentifiers.contains(identifier) { 198 | let index = self.selectIndentifiers.index(of: identifier) 199 | self.phImageFileUrls.remove(at: index!) 200 | self.selectImages.remove(at: index!) 201 | } 202 | 203 | let identifierIndex = self.selectIndentifiers.index(of: identifier) 204 | self.selectIndentifiers.remove(at: identifierIndex!) 205 | 206 | self.redTagLbl.isHidden = (self.selectIndentifiers.count == 0) 207 | self.redTagLbl.text = "\(self.selectIndentifiers.count)" 208 | 209 | return true 210 | } 211 | 212 | let requestOptions = PHImageRequestOptions() 213 | requestOptions.deliveryMode = .highQualityFormat 214 | requestOptions.isNetworkAccessAllowed = true 215 | 216 | self.imageManager.requestImage(for: asset, targetSize: CGSize(width:100,height:100), contentMode: .aspectFill, options: requestOptions) { (image, info) -> Void in 217 | if image != nil { 218 | self.selectImages.append(image!) 219 | if info![PHImageFileURLKey] != nil { 220 | self.phImageFileUrls.append(info!["PHImageFileURLKey"] as! NSURL) 221 | } 222 | self.redTagLbl.isHidden = (self.selectIndentifiers.count == 0) 223 | self.redTagLbl.text = "\(self.selectIndentifiers.count)" 224 | } 225 | } 226 | 227 | return true 228 | } 229 | 230 | private func checkBeyondMaxSelectPickerCount()->Bool{ 231 | if (self.selectIndentifiers.count >= self.selectPickerMaxCount) { 232 | self.showWatting(str: "选择照片不能超过\(self.selectPickerMaxCount!)张") 233 | UIView.animate(withDuration: 1.0, animations: { () -> Void in 234 | self.hideWatting() 235 | }) 236 | return false 237 | } 238 | return true 239 | } 240 | 241 | func done(){ 242 | if self.delegate != nil{ 243 | self.delegate?.imagePickerDidSelectedAssets(assets: self.selectImages, assetIdentifiers: self.selectIndentifiers, phImageFileUrls: self.phImageFileUrls) 244 | } 245 | 246 | UIView.animate(withDuration: 0.25, animations: { () -> Void in 247 | self.albumContainerView.frame = CGRect(x:0, y:self.frame.height, width:self.albumContainerView.frame.width, height:self.albumContainerView.frame.height) 248 | }) { ( flag:Bool) -> Void in 249 | self.removeFromSuperview() 250 | } 251 | } 252 | 253 | func openAlbum(){ 254 | 255 | UIView.animate(withDuration: 0.25, animations: { () -> Void in 256 | self.albumContainerView.frame = CGRect(x:0, y:self.frame.height, width:self.albumContainerView.frame.width, height:self.albumContainerView.frame.height) 257 | }) { ( flag:Bool) -> Void in 258 | self.removeFromSuperview() 259 | } 260 | 261 | let pickerVc = MLImagePickerController() 262 | // 回调 263 | pickerVc.delegate = self.delegate 264 | // 最大图片个数 265 | pickerVc.selectPickerMaxCount = 20 266 | // 默认记录选择的图片 267 | pickerVc.selectIndentifiers = self.selectIndentifiers 268 | pickerVc.show(vc: self.viewControllerReponse!) 269 | } 270 | 271 | override func layoutSubviews() { 272 | super.layoutSubviews() 273 | 274 | if self.albumContainerView == nil{ 275 | self.setupCollectionView() 276 | } 277 | } 278 | } 279 | -------------------------------------------------------------------------------- /Swift2.0+/MLImagePickerController-master/Demo/MLImagePickerController/MLImagePickerController/Classes/ViewController/MLImagePickerQuickView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MLImagePickerQuickView.swift 3 | // MLImagePickerController 4 | // 5 | // Created by 张磊 on 16/3/26. 6 | // Copyright © 2016年 zhanglei. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import PhotosUI 11 | 12 | let MLImagePickerMenuHeight:CGFloat = 40 13 | 14 | class MLImagePickerQuickView: UIView, 15 | UICollectionViewDataSource, 16 | UICollectionViewDelegate, 17 | UICollectionViewDelegateFlowLayout, 18 | MLImagePickerAssetsCellDelegate 19 | { 20 | 21 | private var fetchResult:PHFetchResult! 22 | private var imageManager:MLImagePickerAssetsManger! 23 | private var photoIdentifiers:Array = [] 24 | private var phImageFileUrls:Array! = [] 25 | private var selectImages:Array = [] 26 | private var listsImages:Array = [] 27 | 28 | private var collectionView:UICollectionView! 29 | private var redTagLbl:UILabel! 30 | private var messageLbl:UILabel! 31 | private var albumContainerView:UIView! 32 | 33 | // MARK: Public 34 | // , SelectAssets CallBack 35 | var delegate:MLImagePickerControllerDelegate? 36 | // Selected Indentifiers Assets 37 | var selectIndentifiers:Array! = [] 38 | // Setting Max Multiselect Count 39 | var selectPickerMaxCount:Int! = 9 40 | // Scroll Selecte Pickers, Default is YES 41 | var cancleLongGestureScrollSelectedPicker:Bool! = false 42 | // picker list count, Default is 50 43 | var showListsPickerCount:Int! = 50 44 | // if viewControllerReponse is nil, but not open album. 45 | var viewControllerReponse:UIViewController? 46 | 47 | // Must realize. 48 | func prepareForInterfaceBuilderAndData() { 49 | self.setupCollectionView() 50 | } 51 | 52 | func setupCollectionView(){ 53 | 54 | let albumContainerView:UIView = UIView(frame: CGRectMake(0, self.frame.height, self.frame.width, self.frame.height)) 55 | albumContainerView.backgroundColor = UIColor.whiteColor() 56 | self.addSubview(albumContainerView) 57 | self.albumContainerView = albumContainerView 58 | 59 | let menuView:UIView = UIView() 60 | menuView.borderColor = UIColor(red: 231/256.0, green: 231/256.0, blue: 231/256.0, alpha: 1.0) 61 | menuView.borderWidth = 0.5 62 | menuView.frame = CGRectMake(0, 0, self.frame.width, MLImagePickerMenuHeight) 63 | albumContainerView.addSubview(menuView) 64 | 65 | if self.viewControllerReponse != nil { 66 | let openAlbumBtn = UIButton(frame: CGRectMake(15, 0, 60, MLImagePickerMenuHeight)) 67 | openAlbumBtn.setTitleColor(UIColor(red: 49/256.0, green: 105/256.0, blue: 245/256.0, alpha: 1.0), forState: .Normal) 68 | openAlbumBtn.titleLabel?.font = UIFont.systemFontOfSize(14) 69 | openAlbumBtn.setTitle("打开相册", forState: .Normal) 70 | openAlbumBtn.addTarget(self, action: "openAlbum", forControlEvents: .TouchUpInside) 71 | menuView.addSubview(openAlbumBtn) 72 | } 73 | 74 | let doneBtn = UIButton(frame: CGRectMake(self.frame.width - MLImagePickerMenuHeight - 15, 0, MLImagePickerMenuHeight, MLImagePickerMenuHeight)) 75 | doneBtn.setTitleColor(UIColor(red: 49/256.0, green: 105/256.0, blue: 245/256.0, alpha: 1.0), forState: .Normal) 76 | doneBtn.titleLabel?.font = UIFont.systemFontOfSize(14) 77 | doneBtn.setTitle("完成", forState: .Normal) 78 | doneBtn.addTarget(self, action: "done", forControlEvents: .TouchUpInside) 79 | menuView.addSubview(doneBtn) 80 | 81 | let redTagLbl = UILabel() 82 | redTagLbl.hidden = (self.selectIndentifiers.count == 0) 83 | redTagLbl.text = "\(self.selectIndentifiers.count)" 84 | redTagLbl.layer.cornerRadius = 8.0 85 | redTagLbl.layer.masksToBounds = true 86 | redTagLbl.backgroundColor = UIColor.redColor() 87 | redTagLbl.textColor = UIColor.whiteColor() 88 | redTagLbl.font = UIFont.systemFontOfSize(12) 89 | redTagLbl.textAlignment = .Center 90 | redTagLbl.frame = CGRectMake(CGRectGetMaxX(doneBtn.frame)-10,4, 16, 16) 91 | menuView.addSubview(redTagLbl) 92 | self.redTagLbl = redTagLbl 93 | 94 | let layout:UICollectionViewFlowLayout = UICollectionViewFlowLayout() 95 | layout.scrollDirection = .Horizontal 96 | layout.minimumInteritemSpacing = 5 97 | layout.minimumLineSpacing = 0 98 | 99 | let collectionView:UICollectionView = UICollectionView(frame: CGRectMake(0, CGRectGetMaxY(menuView.frame), self.frame.width, self.frame.height - MLImagePickerMenuHeight), collectionViewLayout: layout) 100 | collectionView.backgroundColor = UIColor.whiteColor() 101 | collectionView.registerNib(UINib(nibName: "MLImagePickerAssetsCell", bundle: nil), forCellWithReuseIdentifier: "MLImagePickerAssetsCell") 102 | collectionView.dataSource = self 103 | collectionView.delegate = self 104 | collectionView.showsHorizontalScrollIndicator = false 105 | collectionView.showsVerticalScrollIndicator = false 106 | 107 | albumContainerView.addSubview(collectionView) 108 | self.collectionView = collectionView 109 | 110 | self.imageManager = MLImagePickerAssetsManger() 111 | self.imageManager.stopCachingImagesForAllAssets() 112 | self.fetchResult = self.imageManager.result() 113 | 114 | let requestOptions = PHImageRequestOptions() 115 | requestOptions.deliveryMode = .HighQualityFormat 116 | requestOptions.networkAccessAllowed = true 117 | requestOptions.synchronous = true 118 | 119 | let count = self.fetchResult.count > 50 ? 50 : self.fetchResult.count 120 | 121 | for (var i = 0; i < count; i++){ 122 | let asset:PHAsset = self.fetchResult[i] as! PHAsset 123 | self.photoIdentifiers.append(asset.localIdentifier) 124 | 125 | self.imageManager.requestImageForAsset(asset, targetSize: CGSizeMake(self.frame.height,self.frame.height), contentMode: .AspectFill, options: requestOptions) { (let image, let info:[NSObject : AnyObject]?) -> Void in 126 | self.listsImages.append(image!) 127 | 128 | if self.selectIndentifiers.contains(asset.localIdentifier) == true { 129 | self.selectImages.append(image!) 130 | if info![PHImageFileURLKey] != nil { 131 | self.phImageFileUrls.append(info![PHImageFileURLKey] as! NSURL) 132 | } 133 | self.selectImages.append(image!) 134 | } 135 | 136 | UIView.animateWithDuration(0.25, animations: { () -> Void in 137 | self.albumContainerView.frame = self.bounds 138 | }) 139 | 140 | self.collectionView?.reloadData() 141 | self.collectionView?.layoutIfNeeded() 142 | } 143 | 144 | } 145 | } 146 | 147 | func numberOfSectionsInCollectionView(collectionView: UICollectionView) -> Int { 148 | return 1 149 | } 150 | 151 | func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { 152 | return self.listsImages.count 153 | } 154 | 155 | func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell { 156 | let cell:MLImagePickerAssetsCell = collectionView.dequeueReusableCellWithReuseIdentifier("MLImagePickerAssetsCell", forIndexPath: indexPath) as! MLImagePickerAssetsCell 157 | 158 | let asset:PHAsset = self.fetchResult[indexPath.item] as! PHAsset 159 | cell.delegate = self 160 | cell.asset = asset 161 | cell.indexPath = indexPath 162 | cell.localIdentifier = self.photoIdentifiers[indexPath.item] 163 | cell.selectButtonSelected = self.selectIndentifiers.contains(cell.localIdentifier) 164 | cell.isShowVideo = (asset.mediaType == .Video) 165 | cell.imageV.image = self.listsImages[indexPath.item] 166 | 167 | return cell 168 | } 169 | 170 | func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAtIndexPath indexPath: NSIndexPath) -> CGSize { 171 | 172 | let image:UIImage = self.listsImages[indexPath.item] 173 | let radio:CGFloat = image.size.height / collectionView.frame.height 174 | 175 | return CGSize(width: image.size.width / radio, height: collectionView.frame.height) 176 | } 177 | 178 | // MARK: MLImagePickerAssetsCellDelegate 179 | func imagePickerSelectAssetsCellWithSelected(indexPath: NSIndexPath, selected: Bool) -> Bool { 180 | let identifier = self.photoIdentifiers[indexPath.item] 181 | let asset:PHAsset = self.fetchResult[indexPath.item] as! PHAsset 182 | 183 | if selected == true { 184 | if (self.checkBeyondMaxSelectPickerCount() == false){ 185 | return false 186 | } 187 | if self.selectIndentifiers.contains(identifier) == false { 188 | // Insert 189 | self.selectIndentifiers.append(identifier) 190 | }else{ 191 | return false; 192 | } 193 | }else{ 194 | // Delete 195 | if selectIndentifiers.contains(identifier) { 196 | let index = self.selectIndentifiers.indexOf(identifier) 197 | self.phImageFileUrls.removeAtIndex(index!) 198 | self.selectImages.removeAtIndex(index!) 199 | } 200 | 201 | let identifierIndex = self.selectIndentifiers.indexOf(identifier) 202 | self.selectIndentifiers.removeAtIndex(identifierIndex!) 203 | 204 | self.redTagLbl.hidden = (self.selectIndentifiers.count == 0) 205 | self.redTagLbl.text = "\(self.selectIndentifiers.count)" 206 | 207 | return true 208 | } 209 | 210 | let requestOptions = PHImageRequestOptions() 211 | requestOptions.deliveryMode = .HighQualityFormat 212 | requestOptions.networkAccessAllowed = true 213 | 214 | self.imageManager.requestImageForAsset(asset, targetSize: CGSizeMake(100,100), contentMode: .AspectFill, options: requestOptions) { (let image, let info:[NSObject : AnyObject]?) -> Void in 215 | if image != nil { 216 | self.selectImages.append(image!) 217 | if info![PHImageFileURLKey] != nil { 218 | self.phImageFileUrls.append(info!["PHImageFileURLKey"] as! NSURL) 219 | } 220 | self.redTagLbl.hidden = (self.selectIndentifiers.count == 0) 221 | self.redTagLbl.text = "\(self.selectIndentifiers.count)" 222 | } 223 | } 224 | 225 | return true 226 | } 227 | 228 | private func checkBeyondMaxSelectPickerCount()->Bool{ 229 | if (self.selectIndentifiers.count >= self.selectPickerMaxCount) { 230 | self.showWatting("选择照片不能超过\(self.selectPickerMaxCount!)张") 231 | UIView.animateWithDuration(1.0, animations: { () -> Void in 232 | self.hideWatting() 233 | }) 234 | return false 235 | } 236 | return true 237 | } 238 | 239 | func done(){ 240 | if self.delegate != nil{ 241 | self.delegate?.imagePickerDidSelectedAssets(self.selectImages, assetIdentifiers: self.selectIndentifiers, phImageFileUrls: self.phImageFileUrls) 242 | } 243 | 244 | UIView.animateWithDuration(0.25, animations: { () -> Void in 245 | self.albumContainerView.frame = CGRectMake(0, self.frame.height, self.albumContainerView.frame.width, self.albumContainerView.frame.height) 246 | }) { (let flag:Bool) -> Void in 247 | self.removeFromSuperview() 248 | } 249 | } 250 | 251 | func openAlbum(){ 252 | 253 | UIView.animateWithDuration(0.25, animations: { () -> Void in 254 | self.albumContainerView.frame = CGRectMake(0, self.frame.height, self.albumContainerView.frame.width, self.albumContainerView.frame.height) 255 | }) { (let flag:Bool) -> Void in 256 | self.removeFromSuperview() 257 | } 258 | 259 | let pickerVc = MLImagePickerController() 260 | // 回调 261 | pickerVc.delegate = self.delegate 262 | // 最大图片个数 263 | pickerVc.selectPickerMaxCount = 20 264 | // 默认记录选择的图片 265 | pickerVc.selectIndentifiers = self.selectIndentifiers 266 | pickerVc.show(self.viewControllerReponse!) 267 | } 268 | 269 | override func layoutSubviews() { 270 | super.layoutSubviews() 271 | 272 | if self.albumContainerView == nil{ 273 | self.setupCollectionView() 274 | } 275 | } 276 | } 277 | -------------------------------------------------------------------------------- /MLImagePickerController/Classes/ViewController/MLImagePickerController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MLImagePickerController.swift 3 | // MLImagePickerController 4 | // 5 | // Created by zhanglei on 16/3/14. 6 | // Copyright © 2016年 zhanglei. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import Photos 11 | 12 | protocol MLImagePickerControllerDelegate { 13 | func imagePickerDidSelectedAssets(assets:NSArray, assetIdentifiers:NSArray) 14 | } 15 | 16 | class MLImagePickerController: UIViewController, 17 | UICollectionViewDataSource, 18 | UICollectionViewDelegate, 19 | MLImagePickerAssetsCellDelegate, 20 | UITableViewDataSource, 21 | UITableViewDelegate 22 | { 23 | 24 | var fetchResult:PHFetchResult! 25 | var collectionView:UICollectionView? 26 | let CELL_MARGIN:CGFloat = 2 27 | let CELL_ROW:CGFloat = 3 28 | var selectIndentifiers:NSMutableArray = [] 29 | let selectImages:NSMutableArray = [] 30 | let photoIdentifiers:NSMutableArray = [] 31 | var groupTableView:UITableView? 32 | var groupSectionFetchResults:NSMutableArray = [] 33 | var messageLbl:UILabel! 34 | var delegate:MLImagePickerControllerDelegate? 35 | var redTagLbl:UILabel! 36 | var titleBtn:UIButton! 37 | var AssetGridThumbnailSize:CGSize! 38 | var imageManager:PHCachingImageManager! 39 | 40 | func show(vc:UIViewController!){ 41 | let imagePickerVc = MLImagePickerController() 42 | imagePickerVc.delegate = self.delegate 43 | imagePickerVc.selectIndentifiers = selectIndentifiers 44 | let navigationVc = UINavigationController(rootViewController: imagePickerVc) 45 | vc.presentViewController(navigationVc, animated: true, completion: nil) 46 | } 47 | 48 | override func viewDidLoad() { 49 | super.viewDidLoad() 50 | 51 | self.imageManager = PHCachingImageManager() 52 | self.imageManager.stopCachingImagesForAllAssets() 53 | 54 | let scale = UIScreen.mainScreen().scale 55 | let width = (self.view.frame.size.width - CELL_MARGIN * CELL_ROW + 1) / CELL_ROW; 56 | AssetGridThumbnailSize = CGSizeMake(width * scale, width * scale); 57 | 58 | self.view.backgroundColor = UIColor.whiteColor() 59 | self.setupNavigationBar() 60 | self.setupCollectionView() 61 | 62 | let options:PHFetchOptions = PHFetchOptions() 63 | options.sortDescriptors = [NSSortDescriptor(key: "creationDate", ascending: false)] 64 | let result:PHFetchResult = PHAsset.fetchAssetsWithOptions(options) 65 | 66 | let requestOptions = PHImageRequestOptions() 67 | requestOptions.deliveryMode = .FastFormat 68 | requestOptions.networkAccessAllowed = true 69 | self.fetchResult = result 70 | 71 | 72 | for (var i = 0; i < result.count; i++){ 73 | let asset:PHAsset = result[i] as! PHAsset 74 | self.photoIdentifiers.addObject(asset.localIdentifier) 75 | 76 | if self.selectIndentifiers.containsObject(asset.localIdentifier) == true { 77 | self.imageManager.requestImageForAsset(asset, targetSize: AssetGridThumbnailSize, contentMode: .AspectFill, options: requestOptions) { (let image, let info:[NSObject : AnyObject]?) -> Void in 78 | self.selectImages.addObject(image!) 79 | } 80 | } 81 | } 82 | self.collectionView?.reloadData() 83 | } 84 | 85 | func setupNavigationBar(){ 86 | let titleBtn = UIButton(type: .Custom) 87 | titleBtn.frame = CGRectMake(0, 0, 200, 44) 88 | titleBtn.titleLabel?.font = UIFont.systemFontOfSize(16) 89 | titleBtn.setTitleColor(UIColor.grayColor(), forState: .Normal) 90 | titleBtn.setTitle("所有图片", forState: .Normal) 91 | titleBtn.addTarget(self, action: "tappenTitleView", forControlEvents: .TouchUpInside) 92 | self.navigationItem.titleView = titleBtn 93 | self.titleBtn = titleBtn 94 | 95 | let doneBtn = UIButton(type: .System) 96 | doneBtn.titleLabel?.font = UIFont.systemFontOfSize(14) 97 | doneBtn.frame = CGRectMake(0, 0, 30, 44) 98 | doneBtn.setTitle("完成", forState: .Normal) 99 | doneBtn.addTarget(self, action: "done", forControlEvents: .TouchUpInside) 100 | self.navigationItem.rightBarButtonItem = UIBarButtonItem(customView: doneBtn) 101 | 102 | let redTagLbl = UILabel() 103 | redTagLbl.hidden = (self.selectIndentifiers.count == 0) 104 | redTagLbl.text = "\(self.selectIndentifiers.count)" 105 | redTagLbl.layer.cornerRadius = 8.0 106 | redTagLbl.layer.masksToBounds = true 107 | redTagLbl.backgroundColor = UIColor.redColor() 108 | redTagLbl.textColor = UIColor.whiteColor() 109 | redTagLbl.font = UIFont.systemFontOfSize(12) 110 | redTagLbl.textAlignment = .Center 111 | redTagLbl.frame = CGRectMake(doneBtn.frame.width-8,0, 16, 16) 112 | doneBtn.addSubview(redTagLbl) 113 | self.redTagLbl = redTagLbl 114 | } 115 | 116 | func done(){ 117 | if self.delegate != nil{ 118 | self.delegate?.imagePickerDidSelectedAssets(self.selectImages, assetIdentifiers: self.selectIndentifiers) 119 | } 120 | self.dismissViewControllerAnimated(true, completion: nil) 121 | } 122 | 123 | func setupCollectionView(){ 124 | let width = (self.view.frame.size.width - CELL_MARGIN * CELL_ROW + 1) / CELL_ROW; 125 | 126 | let collectionViewFlowLayout = UICollectionViewFlowLayout() 127 | collectionViewFlowLayout.scrollDirection = .Vertical 128 | collectionViewFlowLayout.minimumInteritemSpacing = 0 129 | collectionViewFlowLayout.minimumLineSpacing = 2 130 | collectionViewFlowLayout.itemSize = CGSizeMake(width, width) 131 | 132 | let assetsCollectionView = UICollectionView(frame: CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height), collectionViewLayout: collectionViewFlowLayout) 133 | assetsCollectionView.registerNib(UINib(nibName: "MLImagePickerAssetsCell", bundle: nil), forCellWithReuseIdentifier: "MLImagePickerAssetsCell") 134 | assetsCollectionView.backgroundColor = UIColor.clearColor() 135 | assetsCollectionView.dataSource = self 136 | assetsCollectionView.delegate = self 137 | self.view.addSubview(assetsCollectionView) 138 | self.collectionView = assetsCollectionView 139 | } 140 | 141 | func setupGroupTableView(){ 142 | if (self.groupTableView != nil){ 143 | UIView.animateWithDuration(0.15, animations: { () -> Void in 144 | self.groupTableView?.alpha = (self.groupTableView?.alpha == 1.0) ? 0.0 : 1.0 145 | }) 146 | 147 | }else{ 148 | let groupTableView = UITableView(frame: CGRectMake(0, 64, self.view.frame.width, 300), style: .Plain) 149 | groupTableView.registerNib(UINib(nibName: "MLImagePickerGroupCell", bundle: nil), forCellReuseIdentifier: "MLImagePickerGroupCell") 150 | groupTableView.separatorStyle = .None 151 | groupTableView.alpha = 0.0 152 | groupTableView.dataSource = self 153 | groupTableView.delegate = self 154 | self.view.addSubview(groupTableView) 155 | self.groupTableView = groupTableView 156 | 157 | let options:PHFetchOptions = PHFetchOptions() 158 | options.sortDescriptors = [NSSortDescriptor(key: "creationDate", ascending: false)] 159 | 160 | let allPhotos:PHFetchResult = PHAsset.fetchAssetsWithOptions(options) 161 | let smartAlbums:PHFetchResult = PHAssetCollection.fetchAssetCollectionsWithType(.SmartAlbum, subtype: .AlbumRegular, options: nil) 162 | let userCollections:PHFetchResult = PHCollectionList.fetchTopLevelUserCollectionsWithOptions(nil) 163 | self.groupSectionFetchResults = [allPhotos, smartAlbums, userCollections] 164 | 165 | UIView.animateWithDuration(0.15, animations: { () -> Void in 166 | self.groupTableView?.alpha = (self.groupTableView?.alpha == 1.0) ? 0.0 : 1.0 167 | }) 168 | } 169 | } 170 | 171 | func tappenTitleView(){ 172 | self.setupGroupTableView() 173 | } 174 | 175 | // MARK: UICollectionViewDataSource 176 | func numberOfSectionsInCollectionView(collectionView: UICollectionView) -> Int { 177 | return 1 178 | } 179 | 180 | func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { 181 | return (self.fetchResult.count > 0) ? self.fetchResult.count : 0 182 | } 183 | 184 | func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell { 185 | let cell:MLImagePickerAssetsCell = collectionView.dequeueReusableCellWithReuseIdentifier("MLImagePickerAssetsCell", forIndexPath: indexPath) as! MLImagePickerAssetsCell 186 | 187 | 188 | let asset:PHAsset = self.fetchResult[indexPath.item] as! PHAsset 189 | 190 | cell.delegate = self 191 | cell.indexPath = indexPath 192 | cell.localIdentifier = self.photoIdentifiers[indexPath.item] as! String 193 | cell.selectButtonSelected = self.selectIndentifiers.containsObject(cell.localIdentifier) 194 | cell.isShowVideo = (asset.mediaType == .Video) 195 | 196 | self.imageManager.requestImageForAsset(asset, targetSize: AssetGridThumbnailSize, contentMode: .AspectFill, options: nil) { (let image, let info:[NSObject : AnyObject]?) -> Void in 197 | 198 | // Set the cell's thumbnail image if it's still showing the same asset. 199 | if (cell.localIdentifier == asset.localIdentifier) { 200 | cell.imageV.image = image; 201 | } 202 | } 203 | 204 | 205 | return cell 206 | } 207 | 208 | // MARK TableViewDataSource 209 | func numberOfSectionsInTableView(tableView: UITableView) -> Int { 210 | return self.groupSectionFetchResults.count 211 | } 212 | func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 213 | if section == 0 { 214 | return 1 215 | } else { 216 | let result:PHFetchResult = self.groupSectionFetchResults[section] as! PHFetchResult 217 | return result.count 218 | } 219 | } 220 | 221 | func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { 222 | 223 | let fetchResult:PHFetchResult = self.groupSectionFetchResults[indexPath.section] as! PHFetchResult 224 | 225 | let cell:MLImagePickerGroupCell = tableView.dequeueReusableCellWithIdentifier("MLImagePickerGroupCell") as! MLImagePickerGroupCell 226 | if indexPath.section == 0 { 227 | cell.titleLbl.text = "所有图片" 228 | cell.assetCountLbl.text = "\(fetchResult.count)" 229 | }else{ 230 | let collection:PHAssetCollection = fetchResult[indexPath.row] as! PHAssetCollection 231 | let result:PHFetchResult = PHAsset.fetchAssetsInAssetCollection(collection, options: nil) 232 | cell.titleLbl.text = collection.localizedTitle 233 | cell.assetCountLbl.text = "\(result.count)" 234 | } 235 | 236 | return cell 237 | } 238 | 239 | func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { 240 | 241 | tableView.deselectRowAtIndexPath(indexPath, animated: true) 242 | self.setupGroupTableView() 243 | self.photoIdentifiers.removeAllObjects() 244 | 245 | let cell:MLImagePickerGroupCell = tableView.cellForRowAtIndexPath(indexPath) as! MLImagePickerGroupCell 246 | self.titleBtn.setTitle(cell.titleLbl.text, forState: .Normal) 247 | 248 | var fetchResult:PHFetchResult = self.groupSectionFetchResults[indexPath.section] as! PHFetchResult 249 | 250 | if indexPath.section != 0 { 251 | let collection:PHAssetCollection = fetchResult[indexPath.row] as! PHAssetCollection 252 | fetchResult = PHAsset.fetchAssetsInAssetCollection(collection, options: nil) 253 | } 254 | self.fetchResult = fetchResult 255 | 256 | for (var i = 0; i < fetchResult.count; i++){ 257 | let asset:PHAsset = fetchResult[i] as! PHAsset 258 | self.photoIdentifiers.addObject(asset.localIdentifier) 259 | } 260 | for (var i = 0; i < fetchResult.count; i++){ 261 | let asset:PHAsset = fetchResult[i] as! PHAsset 262 | self.photoIdentifiers.addObject(asset.localIdentifier) 263 | } 264 | self.collectionView?.reloadData() 265 | 266 | } 267 | 268 | func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat { 269 | return 60 270 | } 271 | 272 | func imagePickerSelectAssetsCellWithSelected(indexPath: NSIndexPath, selected: Bool) { 273 | let identifier = self.photoIdentifiers[indexPath.item] 274 | let asset:PHAsset = self.fetchResult[indexPath.item] as! PHAsset 275 | 276 | if selected == true { 277 | // Insert 278 | self.selectIndentifiers.addObject(identifier) 279 | }else{ 280 | // Delete 281 | if selectIndentifiers.containsObject(identifier) { 282 | let index = self.selectIndentifiers.indexOfObject(identifier) 283 | self.selectImages.removeObjectAtIndex(index) 284 | } 285 | self.selectIndentifiers.removeObject(identifier) 286 | 287 | self.redTagLbl.hidden = (self.selectIndentifiers.count == 0) 288 | self.redTagLbl.text = "\(self.selectIndentifiers.count)" 289 | 290 | return 291 | } 292 | 293 | let requestOptions = PHImageRequestOptions() 294 | requestOptions.deliveryMode = .HighQualityFormat 295 | requestOptions.networkAccessAllowed = true 296 | 297 | self.imageManager.requestImageForAsset(asset, targetSize: AssetGridThumbnailSize, contentMode: .AspectFill, options: requestOptions) { (let image, let info:[NSObject : AnyObject]?) -> Void in 298 | if image != nil { 299 | self.selectImages.addObject(image!) 300 | 301 | self.redTagLbl.hidden = (self.selectIndentifiers.count == 0) 302 | self.redTagLbl.text = "\(self.selectIndentifiers.count)" 303 | } 304 | } 305 | 306 | } 307 | 308 | func showWatting(){ 309 | if self.collectionView != nil { 310 | self.collectionView!.userInteractionEnabled = false 311 | } 312 | if self.messageLbl != nil { 313 | UIView.animateWithDuration(0.25, animations: { () -> Void in 314 | self.messageLbl.alpha = 1.0 315 | }) 316 | }else { 317 | let width:CGFloat = 100 318 | let height:CGFloat = 35 319 | let x:CGFloat = (self.view.frame.width - width) * 0.5 320 | let y:CGFloat = (self.view.frame.height - height) * 0.5 321 | let messageLbl:UILabel = UILabel(frame: CGRectMake(x,y,width,height)) 322 | messageLbl.layer.masksToBounds = true 323 | messageLbl.layer.cornerRadius = 5.0 324 | messageLbl.textAlignment = .Center 325 | messageLbl.text = "加载中..." 326 | messageLbl.backgroundColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0.5) 327 | messageLbl.textColor = UIColor.whiteColor() 328 | self.view.addSubview(messageLbl) 329 | self.messageLbl = messageLbl 330 | } 331 | } 332 | 333 | func hideWatting(){ 334 | self.collectionView!.userInteractionEnabled = true 335 | UIView.animateWithDuration(0.25) { () -> Void in 336 | self.messageLbl.alpha = 0.0 337 | } 338 | } 339 | 340 | func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) { 341 | 342 | } 343 | } 344 | -------------------------------------------------------------------------------- /Swift2.0+/MLImagePickerController-master/MLImagePickerController/Classes/ViewController/MLImagePickerController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MLImagePickerController.swift 3 | // MLImagePickerController 4 | // 5 | // Created by zhanglei on 16/3/14. 6 | // Copyright © 2016年 zhanglei. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import Photos 11 | 12 | protocol MLImagePickerControllerDelegate { 13 | func imagePickerDidSelectedAssets(assets:NSArray, assetIdentifiers:NSArray) 14 | } 15 | 16 | class MLImagePickerController: UIViewController, 17 | UICollectionViewDataSource, 18 | UICollectionViewDelegate, 19 | MLImagePickerAssetsCellDelegate, 20 | UITableViewDataSource, 21 | UITableViewDelegate 22 | { 23 | 24 | var fetchResult:PHFetchResult! 25 | var collectionView:UICollectionView? 26 | let CELL_MARGIN:CGFloat = 2 27 | let CELL_ROW:CGFloat = 3 28 | var selectIndentifiers:NSMutableArray = [] 29 | let selectImages:NSMutableArray = [] 30 | let photoIdentifiers:NSMutableArray = [] 31 | var groupTableView:UITableView? 32 | var groupSectionFetchResults:NSMutableArray = [] 33 | var messageLbl:UILabel! 34 | var delegate:MLImagePickerControllerDelegate? 35 | var redTagLbl:UILabel! 36 | var titleBtn:UIButton! 37 | var AssetGridThumbnailSize:CGSize! 38 | var imageManager:PHCachingImageManager! 39 | 40 | func show(vc:UIViewController!){ 41 | let imagePickerVc = MLImagePickerController() 42 | imagePickerVc.delegate = self.delegate 43 | imagePickerVc.selectIndentifiers = selectIndentifiers 44 | let navigationVc = UINavigationController(rootViewController: imagePickerVc) 45 | vc.presentViewController(navigationVc, animated: true, completion: nil) 46 | } 47 | 48 | override func viewDidLoad() { 49 | super.viewDidLoad() 50 | 51 | self.imageManager = PHCachingImageManager() 52 | self.imageManager.stopCachingImagesForAllAssets() 53 | 54 | let scale = UIScreen.mainScreen().scale 55 | let width = (self.view.frame.size.width - CELL_MARGIN * CELL_ROW + 1) / CELL_ROW; 56 | AssetGridThumbnailSize = CGSizeMake(width * scale, width * scale); 57 | 58 | self.view.backgroundColor = UIColor.whiteColor() 59 | self.setupNavigationBar() 60 | self.setupCollectionView() 61 | 62 | let options:PHFetchOptions = PHFetchOptions() 63 | options.sortDescriptors = [NSSortDescriptor(key: "creationDate", ascending: false)] 64 | let result:PHFetchResult = PHAsset.fetchAssetsWithOptions(options) 65 | 66 | let requestOptions = PHImageRequestOptions() 67 | requestOptions.deliveryMode = .FastFormat 68 | requestOptions.networkAccessAllowed = true 69 | self.fetchResult = result 70 | 71 | 72 | for (var i = 0; i < result.count; i++){ 73 | let asset:PHAsset = result[i] as! PHAsset 74 | self.photoIdentifiers.addObject(asset.localIdentifier) 75 | 76 | if self.selectIndentifiers.containsObject(asset.localIdentifier) == true { 77 | self.imageManager.requestImageForAsset(asset, targetSize: AssetGridThumbnailSize, contentMode: .AspectFill, options: requestOptions) { (let image, let info:[NSObject : AnyObject]?) -> Void in 78 | self.selectImages.addObject(image!) 79 | } 80 | } 81 | } 82 | self.collectionView?.reloadData() 83 | } 84 | 85 | func setupNavigationBar(){ 86 | let titleBtn = UIButton(type: .Custom) 87 | titleBtn.frame = CGRectMake(0, 0, 200, 44) 88 | titleBtn.titleLabel?.font = UIFont.systemFontOfSize(16) 89 | titleBtn.setTitleColor(UIColor.grayColor(), forState: .Normal) 90 | titleBtn.setTitle("所有图片", forState: .Normal) 91 | titleBtn.addTarget(self, action: "tappenTitleView", forControlEvents: .TouchUpInside) 92 | self.navigationItem.titleView = titleBtn 93 | self.titleBtn = titleBtn 94 | 95 | let doneBtn = UIButton(type: .System) 96 | doneBtn.titleLabel?.font = UIFont.systemFontOfSize(14) 97 | doneBtn.frame = CGRectMake(0, 0, 30, 44) 98 | doneBtn.setTitle("完成", forState: .Normal) 99 | doneBtn.addTarget(self, action: "done", forControlEvents: .TouchUpInside) 100 | self.navigationItem.rightBarButtonItem = UIBarButtonItem(customView: doneBtn) 101 | 102 | let redTagLbl = UILabel() 103 | redTagLbl.hidden = (self.selectIndentifiers.count == 0) 104 | redTagLbl.text = "\(self.selectIndentifiers.count)" 105 | redTagLbl.layer.cornerRadius = 8.0 106 | redTagLbl.layer.masksToBounds = true 107 | redTagLbl.backgroundColor = UIColor.redColor() 108 | redTagLbl.textColor = UIColor.whiteColor() 109 | redTagLbl.font = UIFont.systemFontOfSize(12) 110 | redTagLbl.textAlignment = .Center 111 | redTagLbl.frame = CGRectMake(doneBtn.frame.width-8,0, 16, 16) 112 | doneBtn.addSubview(redTagLbl) 113 | self.redTagLbl = redTagLbl 114 | } 115 | 116 | func done(){ 117 | if self.delegate != nil{ 118 | self.delegate?.imagePickerDidSelectedAssets(self.selectImages, assetIdentifiers: self.selectIndentifiers) 119 | } 120 | self.dismissViewControllerAnimated(true, completion: nil) 121 | } 122 | 123 | func setupCollectionView(){ 124 | let width = (self.view.frame.size.width - CELL_MARGIN * CELL_ROW + 1) / CELL_ROW; 125 | 126 | let collectionViewFlowLayout = UICollectionViewFlowLayout() 127 | collectionViewFlowLayout.scrollDirection = .Vertical 128 | collectionViewFlowLayout.minimumInteritemSpacing = 0 129 | collectionViewFlowLayout.minimumLineSpacing = 2 130 | collectionViewFlowLayout.itemSize = CGSizeMake(width, width) 131 | 132 | let assetsCollectionView = UICollectionView(frame: CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height), collectionViewLayout: collectionViewFlowLayout) 133 | assetsCollectionView.registerNib(UINib(nibName: "MLImagePickerAssetsCell", bundle: nil), forCellWithReuseIdentifier: "MLImagePickerAssetsCell") 134 | assetsCollectionView.backgroundColor = UIColor.clearColor() 135 | assetsCollectionView.dataSource = self 136 | assetsCollectionView.delegate = self 137 | self.view.addSubview(assetsCollectionView) 138 | self.collectionView = assetsCollectionView 139 | } 140 | 141 | func setupGroupTableView(){ 142 | if (self.groupTableView != nil){ 143 | UIView.animateWithDuration(0.15, animations: { () -> Void in 144 | self.groupTableView?.alpha = (self.groupTableView?.alpha == 1.0) ? 0.0 : 1.0 145 | }) 146 | 147 | }else{ 148 | let groupTableView = UITableView(frame: CGRectMake(0, 64, self.view.frame.width, 300), style: .Plain) 149 | groupTableView.registerNib(UINib(nibName: "MLImagePickerGroupCell", bundle: nil), forCellReuseIdentifier: "MLImagePickerGroupCell") 150 | groupTableView.separatorStyle = .None 151 | groupTableView.alpha = 0.0 152 | groupTableView.dataSource = self 153 | groupTableView.delegate = self 154 | self.view.addSubview(groupTableView) 155 | self.groupTableView = groupTableView 156 | 157 | let options:PHFetchOptions = PHFetchOptions() 158 | options.sortDescriptors = [NSSortDescriptor(key: "creationDate", ascending: false)] 159 | 160 | let allPhotos:PHFetchResult = PHAsset.fetchAssetsWithOptions(options) 161 | let smartAlbums:PHFetchResult = PHAssetCollection.fetchAssetCollectionsWithType(.SmartAlbum, subtype: .AlbumRegular, options: nil) 162 | let userCollections:PHFetchResult = PHCollectionList.fetchTopLevelUserCollectionsWithOptions(nil) 163 | self.groupSectionFetchResults = [allPhotos, smartAlbums, userCollections] 164 | 165 | UIView.animateWithDuration(0.15, animations: { () -> Void in 166 | self.groupTableView?.alpha = (self.groupTableView?.alpha == 1.0) ? 0.0 : 1.0 167 | }) 168 | } 169 | } 170 | 171 | func tappenTitleView(){ 172 | self.setupGroupTableView() 173 | } 174 | 175 | // MARK: UICollectionViewDataSource 176 | func numberOfSectionsInCollectionView(collectionView: UICollectionView) -> Int { 177 | return 1 178 | } 179 | 180 | func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { 181 | return (self.fetchResult.count > 0) ? self.fetchResult.count : 0 182 | } 183 | 184 | func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell { 185 | let cell:MLImagePickerAssetsCell = collectionView.dequeueReusableCellWithReuseIdentifier("MLImagePickerAssetsCell", forIndexPath: indexPath) as! MLImagePickerAssetsCell 186 | 187 | 188 | let asset:PHAsset = self.fetchResult[indexPath.item] as! PHAsset 189 | 190 | cell.delegate = self 191 | cell.indexPath = indexPath 192 | cell.localIdentifier = self.photoIdentifiers[indexPath.item] as! String 193 | cell.selectButtonSelected = self.selectIndentifiers.containsObject(cell.localIdentifier) 194 | cell.isShowVideo = (asset.mediaType == .Video) 195 | 196 | self.imageManager.requestImageForAsset(asset, targetSize: AssetGridThumbnailSize, contentMode: .AspectFill, options: nil) { (let image, let info:[NSObject : AnyObject]?) -> Void in 197 | 198 | // Set the cell's thumbnail image if it's still showing the same asset. 199 | if (cell.localIdentifier == asset.localIdentifier) { 200 | cell.imageV.image = image; 201 | } 202 | } 203 | 204 | 205 | return cell 206 | } 207 | 208 | // MARK TableViewDataSource 209 | func numberOfSectionsInTableView(tableView: UITableView) -> Int { 210 | return self.groupSectionFetchResults.count 211 | } 212 | func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 213 | if section == 0 { 214 | return 1 215 | } else { 216 | let result:PHFetchResult = self.groupSectionFetchResults[section] as! PHFetchResult 217 | return result.count 218 | } 219 | } 220 | 221 | func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { 222 | 223 | let fetchResult:PHFetchResult = self.groupSectionFetchResults[indexPath.section] as! PHFetchResult 224 | 225 | let cell:MLImagePickerGroupCell = tableView.dequeueReusableCellWithIdentifier("MLImagePickerGroupCell") as! MLImagePickerGroupCell 226 | if indexPath.section == 0 { 227 | cell.titleLbl.text = "所有图片" 228 | cell.assetCountLbl.text = "\(fetchResult.count)" 229 | }else{ 230 | let collection:PHAssetCollection = fetchResult[indexPath.row] as! PHAssetCollection 231 | let result:PHFetchResult = PHAsset.fetchAssetsInAssetCollection(collection, options: nil) 232 | cell.titleLbl.text = collection.localizedTitle 233 | cell.assetCountLbl.text = "\(result.count)" 234 | } 235 | 236 | return cell 237 | } 238 | 239 | func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { 240 | 241 | tableView.deselectRowAtIndexPath(indexPath, animated: true) 242 | self.setupGroupTableView() 243 | self.photoIdentifiers.removeAllObjects() 244 | 245 | let cell:MLImagePickerGroupCell = tableView.cellForRowAtIndexPath(indexPath) as! MLImagePickerGroupCell 246 | self.titleBtn.setTitle(cell.titleLbl.text, forState: .Normal) 247 | 248 | var fetchResult:PHFetchResult = self.groupSectionFetchResults[indexPath.section] as! PHFetchResult 249 | 250 | if indexPath.section != 0 { 251 | let collection:PHAssetCollection = fetchResult[indexPath.row] as! PHAssetCollection 252 | fetchResult = PHAsset.fetchAssetsInAssetCollection(collection, options: nil) 253 | } 254 | self.fetchResult = fetchResult 255 | 256 | for (var i = 0; i < fetchResult.count; i++){ 257 | let asset:PHAsset = fetchResult[i] as! PHAsset 258 | self.photoIdentifiers.addObject(asset.localIdentifier) 259 | } 260 | for (var i = 0; i < fetchResult.count; i++){ 261 | let asset:PHAsset = fetchResult[i] as! PHAsset 262 | self.photoIdentifiers.addObject(asset.localIdentifier) 263 | } 264 | self.collectionView?.reloadData() 265 | 266 | } 267 | 268 | func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat { 269 | return 60 270 | } 271 | 272 | func imagePickerSelectAssetsCellWithSelected(indexPath: NSIndexPath, selected: Bool) { 273 | let identifier = self.photoIdentifiers[indexPath.item] 274 | let asset:PHAsset = self.fetchResult[indexPath.item] as! PHAsset 275 | 276 | if selected == true { 277 | // Insert 278 | self.selectIndentifiers.addObject(identifier) 279 | }else{ 280 | // Delete 281 | if selectIndentifiers.containsObject(identifier) { 282 | let index = self.selectIndentifiers.indexOfObject(identifier) 283 | self.selectImages.removeObjectAtIndex(index) 284 | } 285 | self.selectIndentifiers.removeObject(identifier) 286 | 287 | self.redTagLbl.hidden = (self.selectIndentifiers.count == 0) 288 | self.redTagLbl.text = "\(self.selectIndentifiers.count)" 289 | 290 | return 291 | } 292 | 293 | let requestOptions = PHImageRequestOptions() 294 | requestOptions.deliveryMode = .HighQualityFormat 295 | requestOptions.networkAccessAllowed = true 296 | 297 | self.imageManager.requestImageForAsset(asset, targetSize: AssetGridThumbnailSize, contentMode: .AspectFill, options: requestOptions) { (let image, let info:[NSObject : AnyObject]?) -> Void in 298 | if image != nil { 299 | self.selectImages.addObject(image!) 300 | 301 | self.redTagLbl.hidden = (self.selectIndentifiers.count == 0) 302 | self.redTagLbl.text = "\(self.selectIndentifiers.count)" 303 | } 304 | } 305 | 306 | } 307 | 308 | func showWatting(){ 309 | if self.collectionView != nil { 310 | self.collectionView!.userInteractionEnabled = false 311 | } 312 | if self.messageLbl != nil { 313 | UIView.animateWithDuration(0.25, animations: { () -> Void in 314 | self.messageLbl.alpha = 1.0 315 | }) 316 | }else { 317 | let width:CGFloat = 100 318 | let height:CGFloat = 35 319 | let x:CGFloat = (self.view.frame.width - width) * 0.5 320 | let y:CGFloat = (self.view.frame.height - height) * 0.5 321 | let messageLbl:UILabel = UILabel(frame: CGRectMake(x,y,width,height)) 322 | messageLbl.layer.masksToBounds = true 323 | messageLbl.layer.cornerRadius = 5.0 324 | messageLbl.textAlignment = .Center 325 | messageLbl.text = "加载中..." 326 | messageLbl.backgroundColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0.5) 327 | messageLbl.textColor = UIColor.whiteColor() 328 | self.view.addSubview(messageLbl) 329 | self.messageLbl = messageLbl 330 | } 331 | } 332 | 333 | func hideWatting(){ 334 | self.collectionView!.userInteractionEnabled = true 335 | UIView.animateWithDuration(0.25) { () -> Void in 336 | self.messageLbl.alpha = 0.0 337 | } 338 | } 339 | 340 | func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) { 341 | 342 | } 343 | } 344 | -------------------------------------------------------------------------------- /Swift2.0+/MLImagePickerController-master/Demo/MLImagePickerController.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 480C7C031C96BD970002831A /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 480C7C021C96BD970002831A /* AppDelegate.swift */; }; 11 | 480C7C051C96BD970002831A /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 480C7C041C96BD970002831A /* ViewController.swift */; }; 12 | 480C7C081C96BD970002831A /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 480C7C061C96BD970002831A /* Main.storyboard */; }; 13 | 480C7C0A1C96BD970002831A /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 480C7C091C96BD970002831A /* Assets.xcassets */; }; 14 | 480C7C0D1C96BD970002831A /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 480C7C0B1C96BD970002831A /* LaunchScreen.storyboard */; }; 15 | 482CF9B01C9959E500E7F226 /* MBIBDesignableExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 482CF9A61C9959E500E7F226 /* MBIBDesignableExtension.swift */; }; 16 | 482CF9B21C9959E500E7F226 /* MLImagePickerController.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 482CF9A81C9959E500E7F226 /* MLImagePickerController.bundle */; }; 17 | 482CF9B31C9959E500E7F226 /* MLImagePickerAssetsCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 482CF9AA1C9959E500E7F226 /* MLImagePickerAssetsCell.swift */; }; 18 | 482CF9B41C9959E500E7F226 /* MLImagePickerAssetsCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 482CF9AB1C9959E500E7F226 /* MLImagePickerAssetsCell.xib */; }; 19 | 482CF9B51C9959E500E7F226 /* MLImagePickerGroupCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 482CF9AC1C9959E500E7F226 /* MLImagePickerGroupCell.swift */; }; 20 | 482CF9B61C9959E500E7F226 /* MLImagePickerGroupCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 482CF9AD1C9959E500E7F226 /* MLImagePickerGroupCell.xib */; }; 21 | 482CF9B71C9959E500E7F226 /* MLImagePickerController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 482CF9AF1C9959E500E7F226 /* MLImagePickerController.swift */; }; 22 | 48411AB01CA67C67003B8910 /* MLImagePickerQuickView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48411AAF1CA67C67003B8910 /* MLImagePickerQuickView.swift */; }; 23 | 48411AB91CA7AA87003B8910 /* ML+UIImageExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48411AB81CA7AA87003B8910 /* ML+UIImageExtension.swift */; }; 24 | 48411ABB1CA7AC0A003B8910 /* ML+UIViewExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48411ABA1CA7AC0A003B8910 /* ML+UIViewExtension.swift */; }; 25 | 48A5267C1CA51C1E00290AB7 /* MLImageBrowserViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48A5267B1CA51C1E00290AB7 /* MLImageBrowserViewController.swift */; }; 26 | 48DA98B11CA7B834005B9EAE /* MLImagePickerAssetsManger.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48DA98B01CA7B834005B9EAE /* MLImagePickerAssetsManger.swift */; }; 27 | /* End PBXBuildFile section */ 28 | 29 | /* Begin PBXFileReference section */ 30 | 480C7BFF1C96BD970002831A /* MLImagePickerController.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MLImagePickerController.app; sourceTree = BUILT_PRODUCTS_DIR; }; 31 | 480C7C021C96BD970002831A /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 32 | 480C7C041C96BD970002831A /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 33 | 480C7C071C96BD970002831A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 34 | 480C7C091C96BD970002831A /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 35 | 480C7C0C1C96BD970002831A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 36 | 480C7C0E1C96BD970002831A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 37 | 482CF9A61C9959E500E7F226 /* MBIBDesignableExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MBIBDesignableExtension.swift; sourceTree = ""; }; 38 | 482CF9A81C9959E500E7F226 /* MLImagePickerController.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = MLImagePickerController.bundle; sourceTree = ""; }; 39 | 482CF9AA1C9959E500E7F226 /* MLImagePickerAssetsCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MLImagePickerAssetsCell.swift; sourceTree = ""; }; 40 | 482CF9AB1C9959E500E7F226 /* MLImagePickerAssetsCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MLImagePickerAssetsCell.xib; sourceTree = ""; }; 41 | 482CF9AC1C9959E500E7F226 /* MLImagePickerGroupCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MLImagePickerGroupCell.swift; sourceTree = ""; }; 42 | 482CF9AD1C9959E500E7F226 /* MLImagePickerGroupCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MLImagePickerGroupCell.xib; sourceTree = ""; }; 43 | 482CF9AF1C9959E500E7F226 /* MLImagePickerController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MLImagePickerController.swift; sourceTree = ""; }; 44 | 48411AAF1CA67C67003B8910 /* MLImagePickerQuickView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MLImagePickerQuickView.swift; sourceTree = ""; }; 45 | 48411AB81CA7AA87003B8910 /* ML+UIImageExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "ML+UIImageExtension.swift"; sourceTree = ""; }; 46 | 48411ABA1CA7AC0A003B8910 /* ML+UIViewExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "ML+UIViewExtension.swift"; sourceTree = ""; }; 47 | 48A5267B1CA51C1E00290AB7 /* MLImageBrowserViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = MLImageBrowserViewController.swift; path = MLImagePickerController/MLImagePickerController/Classes/ViewController/MLImageBrowserViewController.swift; sourceTree = SOURCE_ROOT; }; 48 | 48DA98B01CA7B834005B9EAE /* MLImagePickerAssetsManger.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MLImagePickerAssetsManger.swift; sourceTree = ""; }; 49 | /* End PBXFileReference section */ 50 | 51 | /* Begin PBXFrameworksBuildPhase section */ 52 | 480C7BFC1C96BD970002831A /* Frameworks */ = { 53 | isa = PBXFrameworksBuildPhase; 54 | buildActionMask = 2147483647; 55 | files = ( 56 | ); 57 | runOnlyForDeploymentPostprocessing = 0; 58 | }; 59 | /* End PBXFrameworksBuildPhase section */ 60 | 61 | /* Begin PBXGroup section */ 62 | 480C7BF61C96BD970002831A = { 63 | isa = PBXGroup; 64 | children = ( 65 | 480C7C011C96BD970002831A /* MLImagePickerController */, 66 | 480C7C001C96BD970002831A /* Products */, 67 | ); 68 | sourceTree = ""; 69 | }; 70 | 480C7C001C96BD970002831A /* Products */ = { 71 | isa = PBXGroup; 72 | children = ( 73 | 480C7BFF1C96BD970002831A /* MLImagePickerController.app */, 74 | ); 75 | name = Products; 76 | sourceTree = ""; 77 | }; 78 | 480C7C011C96BD970002831A /* MLImagePickerController */ = { 79 | isa = PBXGroup; 80 | children = ( 81 | 482CF9A31C9959E400E7F226 /* MLImagePickerController */, 82 | 480C7C021C96BD970002831A /* AppDelegate.swift */, 83 | 480C7C041C96BD970002831A /* ViewController.swift */, 84 | 480C7C061C96BD970002831A /* Main.storyboard */, 85 | 480C7C091C96BD970002831A /* Assets.xcassets */, 86 | 480C7C0B1C96BD970002831A /* LaunchScreen.storyboard */, 87 | 480C7C0E1C96BD970002831A /* Info.plist */, 88 | ); 89 | path = MLImagePickerController; 90 | sourceTree = ""; 91 | }; 92 | 482CF9A31C9959E400E7F226 /* MLImagePickerController */ = { 93 | isa = PBXGroup; 94 | children = ( 95 | 482CF9A41C9959E500E7F226 /* Classes */, 96 | ); 97 | path = MLImagePickerController; 98 | sourceTree = ""; 99 | }; 100 | 482CF9A41C9959E500E7F226 /* Classes */ = { 101 | isa = PBXGroup; 102 | children = ( 103 | 48DA98AF1CA7B834005B9EAE /* Model */, 104 | 482CF9A51C9959E500E7F226 /* Extension */, 105 | 482CF9A81C9959E500E7F226 /* MLImagePickerController.bundle */, 106 | 482CF9A91C9959E500E7F226 /* View */, 107 | 482CF9AE1C9959E500E7F226 /* ViewController */, 108 | ); 109 | path = Classes; 110 | sourceTree = ""; 111 | }; 112 | 482CF9A51C9959E500E7F226 /* Extension */ = { 113 | isa = PBXGroup; 114 | children = ( 115 | 482CF9A61C9959E500E7F226 /* MBIBDesignableExtension.swift */, 116 | 48411AB81CA7AA87003B8910 /* ML+UIImageExtension.swift */, 117 | 48411ABA1CA7AC0A003B8910 /* ML+UIViewExtension.swift */, 118 | ); 119 | path = Extension; 120 | sourceTree = ""; 121 | }; 122 | 482CF9A91C9959E500E7F226 /* View */ = { 123 | isa = PBXGroup; 124 | children = ( 125 | 482CF9AA1C9959E500E7F226 /* MLImagePickerAssetsCell.swift */, 126 | 482CF9AB1C9959E500E7F226 /* MLImagePickerAssetsCell.xib */, 127 | 482CF9AC1C9959E500E7F226 /* MLImagePickerGroupCell.swift */, 128 | 482CF9AD1C9959E500E7F226 /* MLImagePickerGroupCell.xib */, 129 | ); 130 | path = View; 131 | sourceTree = ""; 132 | }; 133 | 482CF9AE1C9959E500E7F226 /* ViewController */ = { 134 | isa = PBXGroup; 135 | children = ( 136 | 48A5267B1CA51C1E00290AB7 /* MLImageBrowserViewController.swift */, 137 | 482CF9AF1C9959E500E7F226 /* MLImagePickerController.swift */, 138 | 48411AAF1CA67C67003B8910 /* MLImagePickerQuickView.swift */, 139 | ); 140 | path = ViewController; 141 | sourceTree = ""; 142 | }; 143 | 48DA98AF1CA7B834005B9EAE /* Model */ = { 144 | isa = PBXGroup; 145 | children = ( 146 | 48DA98B01CA7B834005B9EAE /* MLImagePickerAssetsManger.swift */, 147 | ); 148 | path = Model; 149 | sourceTree = ""; 150 | }; 151 | /* End PBXGroup section */ 152 | 153 | /* Begin PBXNativeTarget section */ 154 | 480C7BFE1C96BD970002831A /* MLImagePickerController */ = { 155 | isa = PBXNativeTarget; 156 | buildConfigurationList = 480C7C111C96BD970002831A /* Build configuration list for PBXNativeTarget "MLImagePickerController" */; 157 | buildPhases = ( 158 | 480C7BFB1C96BD970002831A /* Sources */, 159 | 480C7BFC1C96BD970002831A /* Frameworks */, 160 | 480C7BFD1C96BD970002831A /* Resources */, 161 | ); 162 | buildRules = ( 163 | ); 164 | dependencies = ( 165 | ); 166 | name = MLImagePickerController; 167 | productName = MLImagePickerController; 168 | productReference = 480C7BFF1C96BD970002831A /* MLImagePickerController.app */; 169 | productType = "com.apple.product-type.application"; 170 | }; 171 | /* End PBXNativeTarget section */ 172 | 173 | /* Begin PBXProject section */ 174 | 480C7BF71C96BD970002831A /* Project object */ = { 175 | isa = PBXProject; 176 | attributes = { 177 | CLASSPREFIX = ML; 178 | LastSwiftUpdateCheck = 0710; 179 | LastUpgradeCheck = 0710; 180 | ORGANIZATIONNAME = zhanglei; 181 | TargetAttributes = { 182 | 480C7BFE1C96BD970002831A = { 183 | CreatedOnToolsVersion = 7.1; 184 | }; 185 | }; 186 | }; 187 | buildConfigurationList = 480C7BFA1C96BD970002831A /* Build configuration list for PBXProject "MLImagePickerController" */; 188 | compatibilityVersion = "Xcode 3.2"; 189 | developmentRegion = English; 190 | hasScannedForEncodings = 0; 191 | knownRegions = ( 192 | en, 193 | Base, 194 | ); 195 | mainGroup = 480C7BF61C96BD970002831A; 196 | productRefGroup = 480C7C001C96BD970002831A /* Products */; 197 | projectDirPath = ""; 198 | projectRoot = ""; 199 | targets = ( 200 | 480C7BFE1C96BD970002831A /* MLImagePickerController */, 201 | ); 202 | }; 203 | /* End PBXProject section */ 204 | 205 | /* Begin PBXResourcesBuildPhase section */ 206 | 480C7BFD1C96BD970002831A /* Resources */ = { 207 | isa = PBXResourcesBuildPhase; 208 | buildActionMask = 2147483647; 209 | files = ( 210 | 482CF9B61C9959E500E7F226 /* MLImagePickerGroupCell.xib in Resources */, 211 | 482CF9B21C9959E500E7F226 /* MLImagePickerController.bundle in Resources */, 212 | 480C7C0D1C96BD970002831A /* LaunchScreen.storyboard in Resources */, 213 | 480C7C0A1C96BD970002831A /* Assets.xcassets in Resources */, 214 | 482CF9B41C9959E500E7F226 /* MLImagePickerAssetsCell.xib in Resources */, 215 | 480C7C081C96BD970002831A /* Main.storyboard in Resources */, 216 | ); 217 | runOnlyForDeploymentPostprocessing = 0; 218 | }; 219 | /* End PBXResourcesBuildPhase section */ 220 | 221 | /* Begin PBXSourcesBuildPhase section */ 222 | 480C7BFB1C96BD970002831A /* Sources */ = { 223 | isa = PBXSourcesBuildPhase; 224 | buildActionMask = 2147483647; 225 | files = ( 226 | 48411AB91CA7AA87003B8910 /* ML+UIImageExtension.swift in Sources */, 227 | 48411ABB1CA7AC0A003B8910 /* ML+UIViewExtension.swift in Sources */, 228 | 482CF9B51C9959E500E7F226 /* MLImagePickerGroupCell.swift in Sources */, 229 | 48DA98B11CA7B834005B9EAE /* MLImagePickerAssetsManger.swift in Sources */, 230 | 48A5267C1CA51C1E00290AB7 /* MLImageBrowserViewController.swift in Sources */, 231 | 48411AB01CA67C67003B8910 /* MLImagePickerQuickView.swift in Sources */, 232 | 480C7C051C96BD970002831A /* ViewController.swift in Sources */, 233 | 482CF9B31C9959E500E7F226 /* MLImagePickerAssetsCell.swift in Sources */, 234 | 480C7C031C96BD970002831A /* AppDelegate.swift in Sources */, 235 | 482CF9B71C9959E500E7F226 /* MLImagePickerController.swift in Sources */, 236 | 482CF9B01C9959E500E7F226 /* MBIBDesignableExtension.swift in Sources */, 237 | ); 238 | runOnlyForDeploymentPostprocessing = 0; 239 | }; 240 | /* End PBXSourcesBuildPhase section */ 241 | 242 | /* Begin PBXVariantGroup section */ 243 | 480C7C061C96BD970002831A /* Main.storyboard */ = { 244 | isa = PBXVariantGroup; 245 | children = ( 246 | 480C7C071C96BD970002831A /* Base */, 247 | ); 248 | name = Main.storyboard; 249 | sourceTree = ""; 250 | }; 251 | 480C7C0B1C96BD970002831A /* LaunchScreen.storyboard */ = { 252 | isa = PBXVariantGroup; 253 | children = ( 254 | 480C7C0C1C96BD970002831A /* Base */, 255 | ); 256 | name = LaunchScreen.storyboard; 257 | sourceTree = ""; 258 | }; 259 | /* End PBXVariantGroup section */ 260 | 261 | /* Begin XCBuildConfiguration section */ 262 | 480C7C0F1C96BD970002831A /* Debug */ = { 263 | isa = XCBuildConfiguration; 264 | buildSettings = { 265 | ALWAYS_SEARCH_USER_PATHS = NO; 266 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 267 | CLANG_CXX_LIBRARY = "libc++"; 268 | CLANG_ENABLE_MODULES = YES; 269 | CLANG_ENABLE_OBJC_ARC = YES; 270 | CLANG_WARN_BOOL_CONVERSION = YES; 271 | CLANG_WARN_CONSTANT_CONVERSION = YES; 272 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 273 | CLANG_WARN_EMPTY_BODY = YES; 274 | CLANG_WARN_ENUM_CONVERSION = YES; 275 | CLANG_WARN_INT_CONVERSION = YES; 276 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 277 | CLANG_WARN_UNREACHABLE_CODE = YES; 278 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 279 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 280 | COPY_PHASE_STRIP = NO; 281 | DEBUG_INFORMATION_FORMAT = dwarf; 282 | ENABLE_STRICT_OBJC_MSGSEND = YES; 283 | ENABLE_TESTABILITY = YES; 284 | GCC_C_LANGUAGE_STANDARD = gnu99; 285 | GCC_DYNAMIC_NO_PIC = NO; 286 | GCC_NO_COMMON_BLOCKS = YES; 287 | GCC_OPTIMIZATION_LEVEL = 0; 288 | GCC_PREPROCESSOR_DEFINITIONS = ( 289 | "DEBUG=1", 290 | "$(inherited)", 291 | ); 292 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 293 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 294 | GCC_WARN_UNDECLARED_SELECTOR = YES; 295 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 296 | GCC_WARN_UNUSED_FUNCTION = YES; 297 | GCC_WARN_UNUSED_VARIABLE = YES; 298 | IPHONEOS_DEPLOYMENT_TARGET = 9.1; 299 | MTL_ENABLE_DEBUG_INFO = YES; 300 | ONLY_ACTIVE_ARCH = YES; 301 | SDKROOT = iphoneos; 302 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 303 | }; 304 | name = Debug; 305 | }; 306 | 480C7C101C96BD970002831A /* Release */ = { 307 | isa = XCBuildConfiguration; 308 | buildSettings = { 309 | ALWAYS_SEARCH_USER_PATHS = NO; 310 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 311 | CLANG_CXX_LIBRARY = "libc++"; 312 | CLANG_ENABLE_MODULES = YES; 313 | CLANG_ENABLE_OBJC_ARC = YES; 314 | CLANG_WARN_BOOL_CONVERSION = YES; 315 | CLANG_WARN_CONSTANT_CONVERSION = YES; 316 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 317 | CLANG_WARN_EMPTY_BODY = YES; 318 | CLANG_WARN_ENUM_CONVERSION = YES; 319 | CLANG_WARN_INT_CONVERSION = YES; 320 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 321 | CLANG_WARN_UNREACHABLE_CODE = YES; 322 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 323 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 324 | COPY_PHASE_STRIP = NO; 325 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 326 | ENABLE_NS_ASSERTIONS = NO; 327 | ENABLE_STRICT_OBJC_MSGSEND = YES; 328 | GCC_C_LANGUAGE_STANDARD = gnu99; 329 | GCC_NO_COMMON_BLOCKS = YES; 330 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 331 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 332 | GCC_WARN_UNDECLARED_SELECTOR = YES; 333 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 334 | GCC_WARN_UNUSED_FUNCTION = YES; 335 | GCC_WARN_UNUSED_VARIABLE = YES; 336 | IPHONEOS_DEPLOYMENT_TARGET = 9.1; 337 | MTL_ENABLE_DEBUG_INFO = NO; 338 | SDKROOT = iphoneos; 339 | VALIDATE_PRODUCT = YES; 340 | }; 341 | name = Release; 342 | }; 343 | 480C7C121C96BD970002831A /* Debug */ = { 344 | isa = XCBuildConfiguration; 345 | buildSettings = { 346 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 347 | CODE_SIGN_IDENTITY = "iPhone Developer: Wei Feng Hou (D2ZAZ554Z4)"; 348 | INFOPLIST_FILE = MLImagePickerController/Info.plist; 349 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 350 | PRODUCT_BUNDLE_IDENTIFIER = com.makezl.MLImagePickerController; 351 | PRODUCT_NAME = "$(TARGET_NAME)"; 352 | PROVISIONING_PROFILE = "c38deeb3-c442-454d-9fcf-671fc9090c69"; 353 | }; 354 | name = Debug; 355 | }; 356 | 480C7C131C96BD970002831A /* Release */ = { 357 | isa = XCBuildConfiguration; 358 | buildSettings = { 359 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 360 | CODE_SIGN_IDENTITY = "iPhone Developer: Wei Feng Hou (D2ZAZ554Z4)"; 361 | INFOPLIST_FILE = MLImagePickerController/Info.plist; 362 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 363 | PRODUCT_BUNDLE_IDENTIFIER = com.makezl.MLImagePickerController; 364 | PRODUCT_NAME = "$(TARGET_NAME)"; 365 | PROVISIONING_PROFILE = "c38deeb3-c442-454d-9fcf-671fc9090c69"; 366 | }; 367 | name = Release; 368 | }; 369 | /* End XCBuildConfiguration section */ 370 | 371 | /* Begin XCConfigurationList section */ 372 | 480C7BFA1C96BD970002831A /* Build configuration list for PBXProject "MLImagePickerController" */ = { 373 | isa = XCConfigurationList; 374 | buildConfigurations = ( 375 | 480C7C0F1C96BD970002831A /* Debug */, 376 | 480C7C101C96BD970002831A /* Release */, 377 | ); 378 | defaultConfigurationIsVisible = 0; 379 | defaultConfigurationName = Release; 380 | }; 381 | 480C7C111C96BD970002831A /* Build configuration list for PBXNativeTarget "MLImagePickerController" */ = { 382 | isa = XCConfigurationList; 383 | buildConfigurations = ( 384 | 480C7C121C96BD970002831A /* Debug */, 385 | 480C7C131C96BD970002831A /* Release */, 386 | ); 387 | defaultConfigurationIsVisible = 0; 388 | defaultConfigurationName = Release; 389 | }; 390 | /* End XCConfigurationList section */ 391 | }; 392 | rootObject = 480C7BF71C96BD970002831A /* Project object */; 393 | } 394 | --------------------------------------------------------------------------------