Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

D2C-iOS/MTImagePicker

Repository files navigation

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 7.3 Swift 2.2

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:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
pod 'MTImagePicker', '~> 1.0.1'

#Usage

  • The MTImagePicker is similiar to UIImagePickerController.It's easy to use the image picker following the sample code in demo like below
let imagePicker = MTImagePickerController.instance
imagePicker.mediaTypes = [MTImagePickerMediaType.Photo,MTImagePickerMediaType.Video]
imagePicker.imagePickerDelegate = self
imagePicker.maxCount = 10 // max select count
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
//default is MTImagePickerSource.ALAsset
imagePicker.source = MTImagePickerSource.ALAsset
//imagePicker.source = MTImagePickerSource.Photos (Work on iOS8+)
  • Call presentViewController
self.presentViewController(imagePicker, animated: true, completion: nil)
  • Implement the delegate method accordding to the source.
@objc protocol MTImagePickerControllerDelegate:NSObjectProtocol {
 // Implement it when setting source to MTImagePickerSource.ALAsset
 optional func imagePickerController(picker:MTImagePickerController, didFinishPickingWithAssetsModels models:[MTImagePickerAssetsModel])
 
 // Implement it when setting source to MTImagePickerSource.Photos
 @available(iOS 8.0, *)
 optional func imagePickerController(picker:MTImagePickerController, didFinishPickingWithPhotosModels models:[MTImagePickerPhotosModel])
 
 optional func imagePickerControllerDidCancel(picker: MTImagePickerController)
}

TODO

  • (削除) Add Albums selecting support. (削除ここまで) Done.

About

A WeiXin like multiple imagepicker and video picker using either PhotoKit or AssetsLibrary

Resources

License

Stars

Watchers

Forks

Packages

Contributors

Languages

  • Swift 98.8%
  • Ruby 1.2%

AltStyle によって変換されたページ (->オリジナル) /