Giter Club home page Giter Club logo

imagepickersheetcontroller's Introduction

ImagePickerSheetController

Twitter: @lbrndnr License Carthage compatible

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. ⚠️You can also find an iOS 10 version of this library here⚠️

Screenshot

Usage

ImagePickerSheetController is similar to UIAlertController in its usage.

Example

let controller = ImagePickerSheetController(mediaType: .ImageAndVideo)
controller.addAction(ImagePickerAction(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(ImagePickerAction(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
	println("Send \(controller.selectedImageAssets)")
}))
controller.addAction(ImagePickerAction(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.9.1"

###Carthage

github "lbrndnr/ImagePickerSheetController" ~> 0.9.1

You should also add two new values to your app's Info.plist to tell the user why you need to access the Camera and Photo Library.

<key>NSCameraUsageDescription</key>
<string>Camera usage description</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Photo Library usage description</string>

Requirements

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

Author

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

License

ImagePickerSheetController is licensed under the MIT License.

imagepickersheetcontroller's People

Contributors

lbrndnr avatar balestrapatrick avatar xbeg9 avatar colinta avatar vinnyt avatar liangxianzhe avatar retval avatar

Watchers

Eric Silverberg avatar James Cloos avatar Kyle avatar Doug Anarino avatar  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.