Git Product home page Git Product logo

mtimagepicker's Introduction

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

mtimagepicker's People

Contributors

luowenxing avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.