How to select a UIImage from the camera roll (and use it)

The UIImagePickerController can help us do this with ease.

In this example we’ll instantiate an image picker and tell it what kind of image we want returned. We have a choice of using an edited version, use the original, or start using a camera. Next we present the picker from which the user can select the image:

[emember_protected]

For this to work you need to conform to both the UIImagePickerControllerDelegate protocol, as well as the UINavigationControllerDelegate. The latter does not need to conform to any methods – but without it we’d get a warning.

The two methods we need to conform to the first protocol are dealing with selection and cancellation. In this example I’m displaying the returned image in a UIImageView:

[/emember_protected]

About Jay Versluis

Jay is a medical miracle known as Super Survivor. He runs two YouTube channels, five websites and several podcast feeds. To see what else he's up to, and to support him on his mission to make the world a better place, check out his Patreon Campaign.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.