An image picker that mimics iMessage in iOS8

An image picker that mimics iMessage in iOS8

Supported platforms: iOS

Operating environment: iOS

Development language: Swift

Development tools: Xcode

Source code size: 61.43KB

Source code introduction

This demo is an image picker that imitates iMessage in iOS 8. The images to be selected can be scrolled in the option list view.

Source code running screenshot

Source code snippet

    override func viewDidLoad() {

    super .viewDidLoad()

              

    let tapRecognizer = UITapGestureRecognizer(target: self, action: "presentImagePickerSheet:" )

    self.view.addGestureRecognizer(tapRecognizer)

    }

          

    // MARK: Other Methods  

          

    func presentImagePickerSheet(gestureRecognizer: UITapGestureRecognizer) {

    let authorization = PHPhotopbrary.authorizationStatus()

              

    if authorization == .NotDetermined {

    PHPhotopbrary.requestAuthorization({ (status) -> Void in

    dispatch_async(dispatch_get_main_queue(), { () -> Void in

    self.presentImagePickerSheet(gestureRecognizer)

    })

    })

                  

    return  

    }

              

    if authorization == .Authorized {

    var sheet = BRNImagePickerSheet()

    sheet.numberOfButtons = 3  

    sheet.delegate = self

    sheet.showInView(self.view)

    }

    else {

    let alertView = UIAlertView(title: NSLocapzedString( "An error occurred" , comment: "An error occurred" ), message: NSLocapzedString( "BRNImagePickerSheet needs access to the camera roll" , comment: "BRNImagePickerSheet needs access to the camera roll" ), delegate: nil, cancelButtonTitle: NSLocapzedString( "OK" , comment: "OK" ))

    alertView.show()

    }

    }

Source code download address: http://down..com/data/1968726

<<:  Traffic monitoring of Android application source code

>>:  QR code generation and scanning source code download

Recommend

What are the new changes in Beijing's new energy vehicle subsidy standards?

On February 17, 2017, Beijing Municipal Science a...

Is it better to use CDN or high-defense server configuration for server defense?

Is it better to use CDN or high-defense server co...

Mobei SEO course tenth phase basic class quick start course plus advanced course

Getting Started: A First Look at SEO Purchase hos...

Reviewing TikTok: How to achieve user growth?

There are many articles about how TikTok reached ...

How to operate Toutiao account? After reading this, you will be a master!

Unlike WeChat public accounts that rely solely on...

Do you know the 8 ways to place Tik Tok ads?

Here are 8 ways for brands to use Douyin. Brands ...

Better than Android, is iOS 15’s universal search function so awesome?

Search (Spotlight) has a long history on iOS. In ...

How to increase product repurchase rate? Share 4 tips!

Whether you are doing e-commerce or physical stor...