Volume Control Alert

If you need a quick and dirty volume control, an alert specifically tailored for this purpose is included in the MediaPlayer framework. The alert looks as follows::

To display the alert, adding the following code and include the MediaPlayer framework in your project:

#import <MediaPlayer/MediaPlayer.h> 
 
...
 
// Show the volume control alert
MPVolumeSettingsAlertShow();
 
...
 
// Hide the volume control alert
MPVolumeSettingsAlertHide();

If the user taps Done the alert is dismissed. As shown in the code example, you can also remove the alert through a function call.