The Music Picker
The music picker (MPMediaPickerController) is a view controller (UIViewController) whose view is an self-contained navigation interface in which the user can select a media item. This interface looks very much like the iPod/Music app. You have no access to the actual view; you are expected to present the view controller modally (or, on the iPad, in a popover).
You can limit the type of media items displayed by creating the controller using
initWithMediaTypes:. You can make a prompt appear at the top of the navigation bar (
prompt). And you can govern whether the user can choose multiple media items or just one, with the
allowsPickingMultipleItems property. That’s all there is to it.
While the view is showing, you learn what the user is doing through two delegate methods (MPMediaPickerController):
How you use these depends on the value of the controller’s
allowsPickingMultipleItemsis NO (the default)
Every time the user taps a media item, your
mediaPicker:didPickMediaItems:is called, handing you an MPMediaItemCollection consisting of all items the user has tapped so far (including the same item multiple times if the user taps the same item more than once). When the user taps Cancel, your
- The interface has Plus buttons at the right end of every media item, similar to the iPod/Music ...