A specialized view controller that provides a graphical interface for selecting media items.


class MPMediaPickerController : UIViewController


An MPMediaPickerController object, or media item picker, is a specialized view controller that you employ to provide a graphical interface for selecting media items. To display a media item picker, present it modally on an existing view controller. Presenting an MPMediaPickerController in non-modal mode; for example, pushing a MPMediaPickerController onto an existing UINavigationController stack will cause your app to crash. Media items are described in MPMediaItem.

To respond to user selections and to dismiss a media item picker, use the MPMediaPickerControllerDelegate protocol.


Initializing a Media Item Picker

init(mediaTypes: MPMediaType)

Initializes a media item picker for specified media types.

Responding to Media Item Picker Selections

var delegate: MPMediaPickerControllerDelegate?

The delegate for a media item picker.

protocol MPMediaPickerControllerDelegate

The protocol you implement so that a media item picker can respond to a user making media item selections.

Using a Media Item Picker

var allowsPickingMultipleItems: Bool

A Boolean value specifying the default selection behavior for a media item picker.

var showsCloudItems: Bool

A Boolean value specifying whether to display iCloud Media Library items for a media picker.

var mediaTypes: MPMediaType

The media types that media item picker presents.

var prompt: String?

A prompt, for the user, that appears above the navigation bar buttons.

var showsItemsWithProtectedAssets: Bool

A Boolean value specifying if protect assets are displayed.

See Also

Media Player User Interface

Displaying a Media Picker from Your App

Let users choose the music they want to play by displaying a media picker interface from within your app.

class MPVolumeView

A slider control used to set the system audio output volume, and a button for choosing the audio output route.

Global Volume Setting Methods

Global functions for setting the volume alert window status.