In this recipe we will learn how to play songs that are stored on the iOS device.
Following on from our previous recipe, create a new Single View Application, and name it MusicPlayerExample.
To begin, follow these simple steps as outlined in the following order:
Add a reference to the
MediaPlayer.framework
to your project.Select the
ViewController.xib
files from the Project Navigator window.From the Object Library window, select and drag a
UIToolbar
object, and add this to our view and select the Item button located within our toolbar.From the Attributes Inspector section, change the Title property to read Browse.
Create outlets for this
UIBarButtonItem
, and name itbtnBrowse
.Create the
action
method for the Browse button and name itbtnBrowse
.From the Object Library window, select and drag a
UIBarButtonItem
object, and add this next to the Browse button within our toolbar.From the Attributes Inspector section, change...