MPMediaPickerController Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/MediaPlayer.framework
Availability
Available in iOS 3.0 and later.
Companion guide
Declared in
MPMediaPickerController.h
Related sample code

Overview

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. Media items are described in MPMediaItem Class Reference.

To respond to user selections and to dismiss a media item picker, use the MPMediaPickerControllerDelegate protocol as described in MPMediaPickerControllerDelegate Protocol Reference.

Tasks

Initializing a Media Item Picker

Using a Media Item Picker

Properties

allowsPickingMultipleItems

A Boolean value specifying multiple (YES) or single (NO) selection behavior for a media item picker.

@property (nonatomic) BOOL allowsPickingMultipleItems;
Discussion

The default behavior for a media item picker is NO, which means that the picker allows selection of only a single media item. In this instance, the button for dismissing the picker is labeled “Cancel.”

When using the multiple-selection version, the button for dismissing the picker is labeled “Done.”

Availability
  • Available in iOS 3.0 and later.
Related Sample Code
Declared In
MPMediaPickerController.h

delegate

The delegate for a media item picker.

@property (nonatomic, assign) id <MPMediaPickerControllerDelegate> delegate
Discussion

Typically, you set the delegate to be the same object that initializes and displays the media item picker. The delegate protocol is described in MPMediaPickerControllerDelegate Protocol Reference.

Availability
  • Available in iOS 3.0 and later.
Related Sample Code
Declared In
MPMediaPickerController.h

mediaTypes

The media types that media item picker presents.

@property (nonatomic, readonly) MPMediaType mediaTypes
Discussion

The available media types are listed in the Media Item Type Flags enumeration.

Availability
  • Available in iOS 3.0 and later.
Declared In
MPMediaPickerController.h

prompt

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

@property (nonatomic, copy) NSString *prompt
Availability
  • Available in iOS 3.0 and later.
Related Sample Code
Declared In
MPMediaPickerController.h

showsCloudItems

A Boolean value specifying whether to display iCloud items (YES) or not (NO) for a media picker.

@property (nonatomic) BOOL showsCloudItems
Discussion

The default behavior for a media item picker is YES, which means the the picker shows available iCloud items. A media item is considered an iCloud item if it is available via iTunes Match and is not already stored on the device.

Availability
  • Available in iOS 6.0 and later.
Declared In
MPMediaPickerController.h

Instance Methods

init

Initializes a media item picker for all media types.

- (id) init;
Discussion

The default media type for a media item picker is MPMediaTypeAny.

Availability
  • Available in iOS 3.0 and later.
Declared In
MPMediaPickerController.h

initWithMediaTypes:

Initializes a media item picker for specified media types.

- (id) initWithMediaTypes: (MPMediaType) mediaTypes;
Parameters
mediaTypes

An integer representing the media types for the media item picker. See the Media Item Type Flags enumeration.

Availability
  • Available in iOS 3.0 and later.
See Also
Related Sample Code
Declared In
MPMediaPickerController.h