I'm trying to change the volume in my app with a UISlider. The code I'm using for this is:

[[MPMusicPlayerController applicationMusicPlayer] setVolume:_volumeSlider.value];

The problem with this code is that it shows the volume box from the iPhone the same one that appears when you press the volume up or volume down buttons in the left part of the iPhone. For my app I need to hide this box, because the only thing I care is changing the volume.

有帮助吗?

解决方案

Use an MPVolumeView. It stays in sync with the system volume (adjusting itself when the user, e.g., hits one of the hardware volume buttons), and, more relevantly, suppresses the volume bezel when adjusted.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top