Swift – Camera and UIImagePickerController

Take pictures with the UIImagePickerController. This is a ViewController subclass, that creates a view that allows you to take a picture with the camera.

The UIImagePickerController works with a Delegate to handle working with an image after it has been taken.

Try it for yourself. Create a ViewController with a UIImageView, add an IBOutlet for this. We will use this to display the image, so we need a reference.

Add a UIButton, and add an IBAction. Use this to open the Image Picker controller.

In the button action add:


Leave a Reply

Your email address will not be published. Required fields are marked *