iOS Developer Library

Developer

MediaPlayer Framework Reference MPMediaPickerControllerDelegate Protocol Reference

Options
Deployment Target:

On This Page
Language:

MPMediaPickerControllerDelegate

Inheritance


Not Applicable

Conforms To


Import Statement


Swift

import MediaPlayer

Objective-C

@import MediaPlayer;

Availability


Available in iOS 3.0 and later.

The delegate for a media item picker can respond to a user making media item selections. The delegate is also responsible for dismissing the media item picker from the parent view controller. The methods in this protocol are optional.

Media items are described in MPMediaItem Class Reference. Media item pickers are described in MPMediaPickerController Class Reference.

  • Called when a user has selected a set of media items.

    Declaration

    Swift

    optional func mediaPicker(_ mediaPicker: MPMediaPickerController!, didPickMediaItems mediaItemCollection: MPMediaItemCollection!)

    Objective-C

    - (void)mediaPicker:(MPMediaPickerController *)mediaPicker didPickMediaItems:(MPMediaItemCollection *)mediaItemCollection

    Parameters

    mediaPicker

    The media item picker to dismiss.

    mediaItemCollection

    The selected media items.

    Import Statement

    Objective-C

    @import MediaPlayer;

    Swift

    import MediaPlayer

    Availability

    Available in iOS 3.0 and later.

  • Called when a user dismisses a media item picker by tapping Cancel.

    Declaration

    Swift

    optional func mediaPickerDidCancel(_ mediaPicker: MPMediaPickerController!)

    Objective-C

    - (void)mediaPickerDidCancel:(MPMediaPickerController *)mediaPicker

    Parameters

    mediaPicker

    The media item picker to dismiss.

    Import Statement

    Objective-C

    @import MediaPlayer;

    Swift

    import MediaPlayer

    Availability

    Available in iOS 3.0 and later.