iOS Developer Library — Pre-Release

Developer

MediaPlayer Framework Reference MPMediaPickerController Class Reference

Options
Deployment Target:

On This Page
Language:

MPMediaPickerController

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. More...

Inheritance


Import Statement


Swift

import MediaPlayer

Objective-C

@import MediaPlayer;

Availability


Available in iOS 3.0 and later.
  • init - init Available in iOS 3.0 through iOS 7.1

    Initializes a media item picker for all media types.

    Declaration

    Objective-C

    - (instancetype)init

    Discussion

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

    Availability

    Available in iOS 3.0 through iOS 7.1.

  • init(mediaTypes:) - initWithMediaTypes: Designated Initializer

    Initializes a media item picker for specified media types.

    Declaration

    Swift

    init!(mediaTypes mediaTypes: MPMediaType)

    Objective-C

    - (instancetype)initWithMediaTypes:(MPMediaType)mediaTypes

    Parameters

    mediaTypes

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

    Import Statement

    Swift

    import MediaPlayer

    Availability

    Available in iOS 3.0 and later.

    See Also

    – init

  • A Boolean value specifying multiple (YEStrue) or single (NOfalse) selection behavior for a media item picker.

    Declaration

    Swift

    var allowsPickingMultipleItems: Bool

    Objective-C

    @property(nonatomic) BOOL allowsPickingMultipleItems

    Discussion

    The default behavior for a media item picker is NOfalse, 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.”

    Import Statement

    Swift

    import MediaPlayer

    Availability

    Available in iOS 3.0 and later.

  • A Boolean value specifying whether to display iCloud items (YEStrue) or not (NOfalse) for a media picker.

    Declaration

    Swift

    var showsCloudItems: Bool

    Objective-C

    @property(nonatomic) BOOL showsCloudItems

    Discussion

    The default behavior for a media item picker is YEStrue, 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.

    Import Statement

    Swift

    import MediaPlayer

    Availability

    Available in iOS 6.0 and later.

  • delegate delegate Property

    The delegate for a media item picker.

    Declaration

    Swift

    weak var delegate: MPMediaPickerControllerDelegate!

    Objective-C

    @property(nonatomic, weak) 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.

    Import Statement

    Swift

    import MediaPlayer

    Availability

    Available in iOS 3.0 and later.

  • The media types that media item picker presents.

    Declaration

    Swift

    var mediaTypes: MPMediaType { get }

    Objective-C

    @property(nonatomic, readonly) MPMediaType mediaTypes

    Discussion

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

    Import Statement

    Swift

    import MediaPlayer

    Availability

    Available in iOS 3.0 and later.

  • prompt prompt Property

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

    Declaration

    Swift

    var prompt: String!

    Objective-C

    @property(nonatomic, copy) NSString *prompt

    Import Statement

    Swift

    import MediaPlayer

    Availability

    Available in iOS 3.0 and later.