项目作者: luowenxing

项目描述 :
A WeiXin like multiple imagepicker and video picker using either PhotoKit or AssetsLibrary
高级语言: Swift
项目地址: git://github.com/luowenxing/MTImagePicker.git
创建时间: 2016-05-23T11:07:26Z
项目社区:https://github.com/luowenxing/MTImagePicker

开源协议:MIT License

下载


MTImagePicker

A WeiXin like multiple image and video picker which is compatible for iOS7+.You can use either ALAssetsLibrary or Photos framework by setting the source of MTImagePickerController.

Demo

demo

Requirement

  • iOS7.0+
  • Build success in Xcode 9.2 Swift 4.0

Installation

  • There is no ohter dependency in MTImagePicker.Recommanded Simply drag the MTImagePicker/MTImagePicker folder to your project.
  • MTImagePicker is also available through CocoaPods. However using CocoaPod in Swift project required dynamic framework therefore iOS8.0+ is needed.To install it, simply add the following line to your Podfile:
    1. source 'https://github.com/CocoaPods/Specs.git'
    2. platform :ios, '8.0'
    3. use_frameworks!
    4. pod 'MTImagePicker', '~> 3.0.2'

Usage

  • The MTImagePicker is similiar to UIImagePickerController.It’s easy to use the image picker following the sample code in demo like below
    1. let imagePicker = MTImagePickerController.instance
    2. imagePicker.mediaTypes = [MTImagePickerMediaType.Photo,MTImagePickerMediaType.Video]
    3. imagePicker.imagePickerDelegate = self
    4. imagePicker.maxCount = 10 // max select count
    5. imagePicker.defaultShowCameraRoll = true // when set to true would show Camera Roll Album like WeChat by default.
  • You can use either ALAssetsLibrary or Photos framework by setting the source of MTImagePickerController
    1. //default is MTImagePickerSource.ALAsset
    2. imagePicker.source = MTImagePickerSource.ALAsset
    3. //imagePicker.source = MTImagePickerSource.Photos (Work on iOS8+)
  • Call presentViewController
    1. self.presentViewController(imagePicker, animated: true, completion: nil)
  • Implement the delegate method accordding to the source.

    1. @objc protocol MTImagePickerControllerDelegate:NSObjectProtocol {
    2. // Implement it when setting source to MTImagePickerSource.ALAsset
    3. optional func imagePickerController(picker:MTImagePickerController, didFinishPickingWithAssetsModels models:[MTImagePickerAssetsModel])
    4. // Implement it when setting source to MTImagePickerSource.Photos
    5. @available(iOS 8.0, *)
    6. optional func imagePickerController(picker:MTImagePickerController, didFinishPickingWithPhotosModels models:[MTImagePickerPhotosModel])
    7. optional func imagePickerControllerDidCancel(picker: MTImagePickerController)
    8. }

TODO

  • Add Albums selecting support. Done.