There is no documented way to to this, but you can use this workaround. Register for AVSystemController_SystemVolumeDidChangeNotification
notification and add an MPVolumeView
which will prevent the system volume view from showing up.
MPVolumeView *volumeView = [[MPVolumeView alloc] initWithFrame:CGRectMake(-100, 0, 10, 0)];
[volumeView sizeToFit];
[self.view addSubview:volumeView];
And don't forget to start an Audio Session
AudioSessionInitialize(NULL, NULL, NULL, NULL);
AudioSessionSetActive(true);
In This case, the MPVolumeView
is hidden from the user.
As for checking if volume up or down was pressed, just grab the current application's volume
float volumeLevel = [[MPMusicPlayerController applicationMusicPlayer] volume];
and compare it with new volume after the button was pressed in notification callback
If you don't want to do it by yourself, there's a drop-in class available in github
https://github.com/blladnar/RBVolumeButtons