New version! It's A Facebook style Image Picker Controller by Swift.
- iOS 7.1+
- ARC
DKImagePickerController is available on Cocoapods. Simply add the following line to your podfile:
# For latest release in cocoapods
pod 'DKImagePickerController'
To use Swift libraries on apps that support iOS 7, you must manually copy the files into your application project. iOS 7.x
let pickerController = DKImagePickerController()
pickerController.didCancelled = { () in
println("didCancelled")
}
pickerController.didSelectedAssets = { [unowned self] (assets: [DKAsset]) in
println("didSelectedAssets")
println(assets)
}
self.presentViewController(pickerController, animated: true) {}
/// The maximum count of assets which the user will be able to select.
public var maxSelectableCount = 999
/// The type of picker interface to be displayed by the controller.
public var assetType = DKImagePickerControllerAssetType.allAssets
/// Whether allows to select photos and videos at the same time.
public var allowMultipleType = true
/// The callback block is executed when user pressed the select button.
public var didSelectedAssets: ((assets: [DKAsset]) -> Void)?
/// The callback block is executed when user pressed the cancel button.
public var didCancelled: (() -> Void)?
/// It will have selected the specific assets.
public var defaultSelectedAssets: [DKAsset]? {
didSet {
if let defaultSelectedAssets = self.defaultSelectedAssets {
for (index, asset) in enumerate(defaultSelectedAssets) {
if asset.isFromCamera {
self.defaultSelectedAssets!.removeAtIndex(index)
}
}
self.selectedAssets = defaultSelectedAssets
self.updateDoneButtonTitle()
}
}
}
It has been supported languages so far:
- en.lproj
- zh-Hans.lproj
If you want to add new language, pull request or issue!
- Simply to take a picture!
- It can hide the camera.
- Simple photo browser.
Any pull requests to be welcome!!!