A set of methods that your delegate object must implement to interact with the image picker interface.


The methods of this protocol notify your delegate when the user either picks an image or movie, or cancels the picker operation. The delegate methods are responsible for dismissing the picker when the operation completes. To dismiss the picker, call the dismissModalViewControllerAnimated: method of the parent controller responsible for displaying the UIImagePickerController object.

To save a still image to the user’s Camera Roll album, call the UIImageWriteToSavedPhotosAlbum(_:_:_:_:) function from within the body of the imagePickerController(_:didFinishPickingMediaWithInfo:) method. To save a movie to the user’s Camera Roll album, instead call the UISaveVideoAtPathToSavedPhotosAlbum(_:_:_:_:) function. These functions, described in UIKit Functions, save the image or movie only; they do not save metadata.

To write additional metadata when saving an image to the Camera Roll, use the PHAssetChangeRequest class from the Photos framework. See the description for the UIImagePickerControllerMediaMetadata key.


Closing the Picker

func imagePickerControllerDidCancel(UIImagePickerController)

Tells the delegate that the user cancelled the pick operation.

Getting the Editing Information

Use these keys to retrieve information from the editing dictionary about what was returned to your delegate object.

let UIImagePickerControllerMediaType: String

Specifies the media type selected by the user.

let UIImagePickerControllerOriginalImage: String

Specifies the original, uncropped image selected by the user.

let UIImagePickerControllerImageURL: String

A key containing the URL of the image file.

let UIImagePickerControllerEditedImage: String

Specifies an image edited by the user.

let UIImagePickerControllerCropRect: String

Specifies the cropping rectangle that was applied to the original image.

let UIImagePickerControllerMediaURL: String

Specifies the filesystem URL for the movie.

let UIImagePickerControllerMediaMetadata: String

Metadata for a newly-captured photograph.

let UIImagePickerControllerLivePhoto: String

The Live Photo representation of the selected or captured photo.

let UIImagePickerControllerPHAsset: String

The key to use when retrieving a Photos asset for the image.

let UIImagePickerControllerReferenceURL: String

The Assets Library URL for the original version of the picked item.



Inherits From

See Also

Responding to Interactions with the Picker