TestsTested | ✗ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Jul 2016 |
SPMSupports SPM | ✗ |
Maintained by Mikhail Vetoshkin.
You can do the next steps to use MVImagePicker:
let ctrl = ImagePickerViewController()
ctrl.delegate = self
ctrl.multipleSelection = false
ctrl.scrollDelegate = self
self.view.addSubview(ctrl.view)
self.addChildViewController(ctrl)
MVImagePicker has several delegate methods:
optional func imagePickerViewControllerDidEnabled(viewController: ImagePickerViewController, isAuthorized: Bool)
This delegate is used when user permits access to the photos on the device
optional func imagePickerViewControllerLibraryDidSelect(viewController: ImagePickerViewController)
This delegate is used when user clicks on the library icon in the top of the MVImagePicker controller
optional func imagePickerViewControllerAlbumOpened(viewController: ImagePickerViewController, album: PHAssetCollection)
This delegate method is used when user opens a library
optional func imagePickerViewControllerBeforeAssetChanged(viewController: ImagePickerViewController)
optional func imagePickerViewControllerAfterAssetChanged(viewController: ImagePickerViewController)
These 2 delegate methods are used before and after user adds a new asset into the library
func imagePickerViewControllerAssetDidCreate(viewController: ImagePickerViewController, asset: PHAsset, locally: Bool)
func imagePickerViewControllerAssetDidRemove(viewController: ImagePickerViewController, asset: PHAsset)
These 2 delegate methods are used when an asset is created or removed from the library (even using Photos or some another app)
func imagePickerViewControllerAssetDidSelect(viewController: ImagePickerViewController, asset: PHAsset, cell: ImagePickerPhotoCell)
func imagePickerViewControllerAssetDidDeselect(viewController: ImagePickerViewController, asset: PHAsset, cell: ImagePickerPhotoCell)
These 2 delegate methods are used when user selects or deselects an asset in the library
optional func imagePickerViewControllerAssetDidLongTap(viewController: ImagePickerViewController, asset: PHAsset, cell: ImagePickerPhotoCell)
This delegate method is used when user does a long tap on any asset in the library
optional func imagePickerViewControllerWillBeginDragging(scrollView: UIScrollView)
optional func imagePickerViewControllerDidEndDragging(scrollView: UIScrollView, willDecelerate decelerate: Bool)
optional func imagePickerViewControllerDidScroll(scrollView: UIScrollView)
These 3 delegates are just wrappers for standard scrollViewWillBeginDragging, scrollViewDidEndDragging and scrollViewDidScroll, and they are used for photos collection view
iOS 8 or above
MVImagePicker is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "MVImagePicker"
To run the example project, clone the repo, and run pod install
from the Example directory first.
Mikhail Vetoshkin, [email protected]
MVImagePicker is available under the MIT license. See the LICENSE file for more info.