iOS: Change Device Volume

后端 未结 3 534
后悔当初
后悔当初 2020-11-28 08:38

Is there a way to change the volume of the device? I\'ve seen several apps do it.

I have a desktop version of the iOS app and the device will be able to be controll

3条回答
  •  刺人心
    刺人心 (楼主)
    2020-11-28 09:25

    Using iPodMusicPlayer would affect the actual iPod volume setting as well. If you want to avoid that, use this:

    #import 
    // ...
    MPMusicPlayerController *musicPlayer = [MPMusicPlayerController applicationMusicPlayer];
    musicPlayer.volume = 1.0f; 
    

    As the user holex correctly mentioned the property volume in MPMusicPlayerController is deprecated in iOS 7.

提交回复
热议问题