pubuim / ImagePickerSheetController

ImagePickerSheetController is like the custom photo action sheet in iMessage just without the glitches.

Home Page:http://laurinbrandner.ch

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ImagePickerSheetController

About

ImagePickerSheetController is a component that replicates the custom photo action sheet in iMessage. It's very similar to UIAlertController which makes its usage simple and concise.

Screenshot

Twitter: @larcus94 License Carthage compatible

Author

I'm Laurin Brandner, I'm on Twitter.

Usage

ImagePickerSheetController is similar to UIAlertController in its usage.

Example

let controller = ImagePickerSheetController()
controller.addAction(ImageAction(title: NSLocalizedString("Take Photo Or Video", comment: "Action Title"), secondaryTitle: NSLocalizedString("Add comment", comment: "Action Title"), handler: { _ in
	presentImagePickerController(.Camera)
}, secondaryHandler: { _, numberOfPhotos in
	println("Comment \(numberOfPhotos) photos")
}))
controller.addAction(ImageAction(title: NSLocalizedString("Photo Library", comment: "Action Title"), secondaryTitle: { NSString.localizedStringWithFormat(NSLocalizedString("ImagePickerSheet.button1.Send %lu Photo", comment: "Action Title"), $0) as String}, handler: { _ in
	presentImagePickerController(.PhotoLibrary)
}, secondaryHandler: { _, numberOfPhotos in
	controller.getSelectedImagesWithCompletion() { images in
		println("Send \(images) photos")
	}
}))
controller.addAction(ImageAction(title: NSLocalizedString("Cancel", comment: "Action Title"), style: .Cancel, handler: { _ in
	println("Cancelled")
}))
            
presentViewController(controller, animated: true, completion: nil)

It's recommended to use stringsdict to easily translate plural forms in any language.

Installation

CocoaPods

pod "ImagePickerSheetController", "~> 0.1.4"

###Carthage

github "larcus94/ImagePickerSheetController" ~> 0.1.4

Requirements

ImagePickerSheetController is written in Swift and links against Photos.framework. It therefore requires iOS 8 or later.

License

ImagePickerSheetController is licensed under the MIT License.

About

ImagePickerSheetController is like the custom photo action sheet in iMessage just without the glitches.

http://laurinbrandner.ch

License:MIT License


Languages

Language:Swift 88.3%Language:Ruby 10.6%Language:C++ 1.1%