GithubHelp home page GithubHelp logo

brnimagepickersheet's Introduction

BRNImagePickerSheet

About

BRNImagePickerSheet is a duplicate of that shiny new custom action sheet seen in iOS8's iMessage that Apple didn't make part of UIKit. It's the first project I've written in Swift. It works well but I might have coded something the Objective-C kind of way. Don't hesitate to open an issue/ pullrequest if you spotted something.

BackgroundImage BackgroundImage

Author

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

Usage

BRNImagePickerSheet's API is similar to the one of UIActionSheet so you should get along with it just well.

Example

let placeholder = BRNImagePickerSheet.selectedPhotoCountPlaceholder
var sheet = BRNImagePickerSheet()
sheet.addButtonWithTitle("Take Photo Or Video", singularSecondaryTitle: "Add Comment", pluralSecondaryTitle: nil)
sheet.addButtonWithTitle("Photo Library", singularSecondaryTitle: "Send \(placeholder) Photo", pluralSecondaryTitle: "Send \(placeholder) Photos")
sheet.delegate = self
sheet.showInView(self.view)

Note that you can use the placeholder to specify where BRNImagePickerSheet should insert the number of selected photos. This allows you to use very custom titles

func imagePickerSheet(imagePickerSheet: BRNImagePickerSheet, willDismissWithButtonIndex buttonIndex: Int) {
    if buttonIndex != imagePickerSheet.cancelButtonIndex {
        if imagePickerSheet.showsSecondaryTitles {
            println(imagePickerSheet.selectedPhotos)
        }
    else {
        let controller = UIImagePickerController()
        controller.delegate = self
        controller.sourceType = (buttonIndex == 2) ? .PhotoLibrary : .Camera
        self.presentViewController(controller, animated: true, completion: nil)
        }
    }
}

Installation

BRNImagePickerSheet will be available via CocoaPods. However there's an issue with Swift compatibility that caused the build to fail. I will release it as soon as possible though.

(There is apparently an issue with Xcode6 and Swift static libs. Check out this issue for more.

Requirements

BRNImagePickerSheet is written in Swift. It therefore runs on iOS 7 and 8.

License

BRNImagePickerSheet is licensed under the MIT License.

brnimagepickersheet's People

Contributors

emilwojtaszek avatar kwojtaszek avatar lbrndnr avatar retval avatar

Watchers

 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.