Tag: UIImagePickerViewController

  • Code Snippet: Creating a custom ImagePickerViewController, like Instagram

    The standard iOS UIImagePickerViewController is a great way for beginners to get started to accessing the camera and photo library. However, it isn’t used by any of the major photo sharing apps, they all have custom ImagePickers. It is possible to create your own ImagePickerViewController and improve the aesthetics of your photo application. It will improve the engagement levels of your app as a well done ImagePickerViewController can be much more user-friendly and painless than the default UIImagePickerViewController. I have created an ImagePicker that you can use.

    Code Snippet:

    The first screen is the custom ImagePicker. The ImagePicker gives the user the ability to select images from their photo album.

    Simulator Screen Shot - iPhone 8 Plus - 2018-04-21 at 23.54.56

    On this screen, there is also a filter button that will take you to a second screen where you can apply filters to the original image.

    Simulator Screen Shot - iPhone 8 Plus - 2018-04-21 at 23.55.14

    The source code for the finished ImagePickerViewController example project is available here:

    https://github.com/rtking1993/RTKImagePickerViewController

     

  • Tutorial: Creating a UIImagePickerController

    Taking and sharing photos is an important feature of many apps. Using the UIImagePickerViewController is a simple and easy way of enabling your user to either take a new photo or get an existing one from the user’s photo library.

    Tutorial:

    First of all, we want to start a new single application template project. We want to set up our main view controller, with the main image view, camera and library button.

    Screen Shot 2018-02-04 at 6.10.30 PM.png

    Then we want to add an important string to our info.plist. We need to add an NSCameraUsageDescription so that we can access the devices’ camera. This is a small sentence that describes to the user why your app requires access to the camera. My sentence is only an example, you can replace it with any description you’d like.

    Screen Shot 2018-02-04 at 6.04.35 PM

    Then we have to implement the code within our UIViewController to handle the button presses, present the UIImagePickerViewController and then handle the UIImagePickerViewControllerDelegate.

    https://gist.github.com/rtking1993/a402e3b4e217a34bc44003f55f7c3f97

    Here is the full source code for the project:

    https://github.com/rtking1993/UIImagePickerViewController