<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.1.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIImagePickerController",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UIImagePickerController"
  },
  "title" : "UIImagePickerController"
}
-->

# UIImagePickerController

A view controller that manages the system interfaces for taking pictures, recording movies, and choosing items from the user’s media library.

```
@MainActor class UIImagePickerController
```

## Overview

An image picker controller manages user interactions and delivers the results of those interactions to a delegate object. The role and appearance of an image picker controller depend on the *source type* you assign to it before you present it.

- A [`sourceType`](/documentation/UIKit/UIImagePickerController/sourceType-swift.property) of [`UIImagePickerController.SourceType.camera`](/documentation/UIKit/UIImagePickerController/SourceType-swift.enum/camera) provides a user interface for taking a new picture or movie (on devices that support media capture).
- A [`sourceType`](/documentation/UIKit/UIImagePickerController/sourceType-swift.property) of [`UIImagePickerController.SourceType.photoLibrary`](/documentation/UIKit/UIImagePickerController/SourceType-swift.enum/photoLibrary) or [`UIImagePickerController.SourceType.savedPhotosAlbum`](/documentation/UIKit/UIImagePickerController/SourceType-swift.enum/savedPhotosAlbum) provides a user interface for choosing among saved pictures and movies.

To use an image picker controller containing its default controls, perform these steps:

1. Verify that the device is capable of picking content from the desired source. Do this by calling the [`isSourceTypeAvailable(_:)`](/documentation/UIKit/UIImagePickerController/isSourceTypeAvailable(_:)) class method, providing a constant from the [`UIImagePickerController.SourceType`](/documentation/UIKit/UIImagePickerController/SourceType-swift.enum) enumeration.
2. Check which media types are available for the source type you’re using, by calling the [`availableMediaTypes(for:)`](/documentation/UIKit/UIImagePickerController/availableMediaTypes(for:)) class method. This lets you distinguish between a camera that can be used for video recording and one that can be used only for still images.
3. Tell the image picker controller to adjust the UI according to the media types you want to make available — still images, movies, or both — by setting the [`mediaTypes`](/documentation/UIKit/UIImagePickerController/mediaTypes) property.
4. Present the user interface. On iPhone or iPod touch, do this modally (full screen) by calling the [`present(_:animated:completion:)`](/documentation/UIKit/UIViewController/present(_:animated:completion:)) method of the currently active view controller, passing your configured image picker controller as the new view controller.

On iPad, the correct way to present an image picker depends on its source type, as summarized in this table:

|Camera         |Photo Library     |Saved Photos Album|
|---------------|------------------|------------------|
|Use full screen|Must use a popover|Must use a popover|

The table indicates that on iPad, if you specify a source type of [`UIImagePickerController.SourceType.photoLibrary`](/documentation/UIKit/UIImagePickerController/SourceType-swift.enum/photoLibrary) or [`UIImagePickerController.SourceType.savedPhotosAlbum`](/documentation/UIKit/UIImagePickerController/SourceType-swift.enum/savedPhotosAlbum), you must present the image picker using a popover controller (to learn how to do this, see [`UIPopoverPresentationController`](/documentation/UIKit/UIPopoverPresentationController)). If you attempt to present an image picker modally (full screen) for choosing among saved pictures and movies, the system raises an exception.

On iPad, if you specify a source type of [`UIImagePickerController.SourceType.camera`](/documentation/UIKit/UIImagePickerController/SourceType-swift.enum/camera), you can present the image picker modally (full screen) or by using a popover. However, Apple recommends that you present the camera interface only full screen.

1. When the user taps a button to pick a newly captured or saved image or movie, or cancels the operation, dismiss the image picker using your delegate object. For newly captured media, your delegate can then save it to the photo library on the device. For previously saved media, your delegate can then use the image data according to the purpose of your app.

For details on these steps, refer to [Taking Pictures and Movies](https://developer.apple.com/library/archive/documentation/AudioVideo/Conceptual/CameraAndPhotoLib_TopicsForIOS/Articles/TakingPicturesAndMovies.html#//apple_ref/doc/uid/TP40010406).

You can customize an image picker controller to manage user interactions yourself. To do this, provide an overlay view containing the controls you want to display, and use the methods described in [`Capturing still images or movies`](/documentation/UIKit/UIImagePickerController#Capturing-still-images-or-movies). You can display your custom overlay view in addition to, or instead of, the default controls. Custom overlay views for the `UIImagePickerController` class are available in iOS 3.1 and later by way of the [`cameraOverlayView`](/documentation/UIKit/UIImagePickerController/cameraOverlayView) property. For a code example, see the [Customizing an image picker controller](/documentation/UIKit/customizing-an-image-picker-controller) sample code project.

> Important:
> The `UIImagePickerController` class supports portrait mode only. This class is intended to be used as-is and doesn’t support subclassing. The view hierarchy for this class is private and must not be modified, with one exception. You can assign a custom view to the ``doc://com.apple.uikit/documentation/UIKit/UIImagePickerController/cameraOverlayView`` property and use that view to present additional information or manage the interactions between the camera interface and your code.

### Provide a delegate object

To use an image picker controller, you must provide a delegate that conforms to the [`UIImagePickerControllerDelegate`](/documentation/UIKit/UIImagePickerControllerDelegate) protocol. Starting in iOS 4.1, you can use the delegate to save still-image metadata to the photo library along with the image. See [`UIImagePickerControllerDelegate`](/documentation/UIKit/UIImagePickerControllerDelegate).

### Observe required viewing standards

As a view controller that renders on top of your app for the temporary purpose of selecting images, the picker controller expects your app to keep its contents visible as a prerequisite to operation. In iOS 17 and later, the picker controller ignores touch events while its opacity is anything other than fully opaque. If your app alters the controller’s visibility, such as by adjusting the <doc://com.apple.documentation/documentation/QuartzCore/CALayer/opacity> of its view’s layer, the picker controller disables user interaction.

### Adjust flash mode

In iOS 4.0 and later, you can provide custom controls to let the user adjust flash mode (on devices that have a flash LED), pick which camera to use (on devices that have a front and rear camera), and switch between still image and movie capture. You can also manage these settings programmatically. You can also manipulate the flash directly to provide effects, such as a strobe light. Present a picker interface set to use video capture mode. Then, turn the flash LED on or off by setting the [`cameraFlashMode`](/documentation/UIKit/UIImagePickerController/cameraFlashMode-swift.property) property to [`UIImagePickerController.CameraFlashMode.on`](/documentation/UIKit/UIImagePickerController/CameraFlashMode-swift.enum/on) or [`UIImagePickerController.CameraFlashMode.off`](/documentation/UIKit/UIImagePickerController/CameraFlashMode-swift.enum/off).

### Work with movies

Movie capture has a default duration limit of 10 minutes but can be adjusted using the [`videoMaximumDuration`](/documentation/UIKit/UIImagePickerController/videoMaximumDuration) property. When a person taps the Share button to send a movie to MMS, YouTube, or another destination, the system applies duration and video quality limitations.

The default camera interface supports editing movies in the photo library. Editing involves trimming from the start or end of the movie, then saving the trimmed movie. To display an interface dedicated to movie editing, rather than one that also supports recording new movies, use the [`UIVideoEditorController`](/documentation/UIKit/UIVideoEditorController) class instead of this one. See [`UIVideoEditorController`](/documentation/UIKit/UIVideoEditorController).

### Work with Live Photos

Live Photos is a Camera app feature on supported devices, enabling a picture to be not just a single moment in time but to include motion and sound from the moments just before and after its capture. A <doc://com.apple.documentation/documentation/Photos/PHLivePhoto> object represents a Live Photo, and the <doc://com.apple.documentation/documentation/PhotosUI/PHLivePhotoView> class provides a system-standard, interactive user interface for displaying a Live Photo and playing back its content.

Although Live Photos include sound and motion, they remain photos. When you use an image picker controller to capture or choose still images (by including only the `kUTTypeImage` type in the [`mediaTypes`](/documentation/UIKit/UIImagePickerController/mediaTypes) array), assets that were captured as Live Photos continue to appear in the picker. However, when the user chooses an asset, your [`delegate`](/documentation/UIKit/UIImagePickerController/delegate) object receives only a [`UIImage`](/documentation/UIKit/UIImage) object containing a still-image representation of the Live Photo.

To obtain the full motion and sound content when the user chooses a Live Photo with the image picker, you must include *both* the `kUTTypeImage` and `kUTTypeLivePhoto` types in the [`mediaTypes`](/documentation/UIKit/UIImagePickerController/mediaTypes) array. For more information, see [`livePhoto`](/documentation/UIKit/UIImagePickerController/InfoKey/livePhoto) in [`UIImagePickerControllerDelegate`](/documentation/UIKit/UIImagePickerControllerDelegate).

### Perform fully customized media capture and browsing

To perform fully customized image or movie capture, instead use the <doc://com.apple.documentation/documentation/AVFoundation> framework as described in [Still and Video Media Capture](https://developer.apple.com/library/archive/documentation/AudioVideo/Conceptual/AVFoundationPG/Articles/00_Introduction.html#//apple_ref/doc/uid/TP40010188-CH1-SW10). Camera access using the AVFoundation framework is available starting in iOS 4.0.

To create a fully customized image picker for browsing the photo library, use classes from the Photos framework. For example, you could create a custom image picker that displays larger thumbnail images generated and cached by iOS, that makes use of image metadata including timestamp and location information, or that integrates with other features such as MapKit and iCloud Photo Sharing. For more information, see <doc://com.apple.documentation/documentation/PhotoKit>. Media browsing using the Photos framework is available starting in iOS 8.0.

## Topics

### Responding to interactions with the picker

[`delegate`](/documentation/UIKit/UIImagePickerController/delegate)

The image picker’s delegate object.

[`UIImagePickerControllerDelegate`](/documentation/UIKit/UIImagePickerControllerDelegate)

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

### Setting the picker source

[`availableMediaTypes(for:)`](/documentation/UIKit/UIImagePickerController/availableMediaTypes(for:))

Retrieves the available media types for the specified source type.

[`isSourceTypeAvailable(_:)`](/documentation/UIKit/UIImagePickerController/isSourceTypeAvailable(_:))

Queries whether the device supports picking media using the specified source type.

[`sourceType`](/documentation/UIKit/UIImagePickerController/sourceType-swift.property)

The type of picker interface to be displayed by the controller.

[`UIImagePickerController.SourceType`](/documentation/UIKit/UIImagePickerController/SourceType-swift.enum)

Constants that describe the source to use when picking an image or when determining available media types.

### Configuring the picker

[`mediaTypes`](/documentation/UIKit/UIImagePickerController/mediaTypes)

An array that indicates the media types to access by the media picker controller.

[`allowsEditing`](/documentation/UIKit/UIImagePickerController/allowsEditing)

A Boolean value that indicates whether the user is allowed to edit a selected still image or movie.

[`allowsImageEditing`](/documentation/UIKit/UIImagePickerController/allowsImageEditing)

A Boolean value that indicates whether the user is allowed to edit a selected image.

### Configuring the video capture options

[`videoQuality`](/documentation/UIKit/UIImagePickerController/videoQuality)

The video recording and transcoding quality.

[`UIImagePickerController.QualityType`](/documentation/UIKit/UIImagePickerController/QualityType)

Constants that describe video quality settings for movies that are recorded with the built-in camera, or that are transcoded when they’re displayed in the image picker.

[`videoMaximumDuration`](/documentation/UIKit/UIImagePickerController/videoMaximumDuration)

The maximum duration, in seconds, for a video recording.

### Customizing the camera controls

[Customizing an image picker controller](/documentation/UIKit/customizing-an-image-picker-controller)

Manage user interactions and present custom information when taking pictures by adding an overlay view to your image picker.

[`showsCameraControls`](/documentation/UIKit/UIImagePickerController/showsCameraControls)

A Boolean value that indicates whether the image picker displays the default camera controls.

[`cameraOverlayView`](/documentation/UIKit/UIImagePickerController/cameraOverlayView)

The view to display on top of the default image picker interface.

[`cameraViewTransform`](/documentation/UIKit/UIImagePickerController/cameraViewTransform)

The transform to apply to the camera’s preview image.

### Capturing still images or movies

[`takePicture()`](/documentation/UIKit/UIImagePickerController/takePicture())

Captures a still image using the camera.

[`startVideoCapture()`](/documentation/UIKit/UIImagePickerController/startVideoCapture())

Starts video capture using the camera specified by the camera device property.

[`stopVideoCapture()`](/documentation/UIKit/UIImagePickerController/stopVideoCapture())

Stops video capture.

### Configuring the camera to use

[`isCameraDeviceAvailable(_:)`](/documentation/UIKit/UIImagePickerController/isCameraDeviceAvailable(_:))

Queries whether the specified camera is available.

[`cameraDevice`](/documentation/UIKit/UIImagePickerController/cameraDevice-swift.property)

The camera used by the image picker controller.

[`UIImagePickerController.CameraDevice`](/documentation/UIKit/UIImagePickerController/CameraDevice-swift.enum)

Constants that specify the camera to use for image or movie capture.

### Configuring the camera capture mode

[`availableCaptureModes(for:)`](/documentation/UIKit/UIImagePickerController/availableCaptureModes(for:))

Retrieves the capture modes supported by the specified camera device.

[`cameraCaptureMode`](/documentation/UIKit/UIImagePickerController/cameraCaptureMode-swift.property)

The capture mode used by the camera.

[`UIImagePickerController.CameraCaptureMode`](/documentation/UIKit/UIImagePickerController/CameraCaptureMode-swift.enum)

Constants that specify the category of media for the camera to capture.

### Configuring the flash behavior

[`isFlashAvailable(for:)`](/documentation/UIKit/UIImagePickerController/isFlashAvailable(for:))

Queries whether the specified camera has flash illumination capability.

[`cameraFlashMode`](/documentation/UIKit/UIImagePickerController/cameraFlashMode-swift.property)

The flash mode used by the active camera.

[`UIImagePickerController.CameraFlashMode`](/documentation/UIKit/UIImagePickerController/CameraFlashMode-swift.enum)

Constants that specify the flash mode to use with the active camera.

### Configuring the export presets

[`imageExportPreset`](/documentation/UIKit/UIImagePickerController/imageExportPreset)

The preset to use when preparing images for export to your app.

[`UIImagePickerController.ImageURLExportPreset`](/documentation/UIKit/UIImagePickerController/ImageURLExportPreset)

Constants that indicate how to export images to the client app.

[`videoExportPreset`](/documentation/UIKit/UIImagePickerController/videoExportPreset)

The preset to use when preparing video for export to your app.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)