iPhone: Implement Volume control using buttons

眉间皱痕 提交于 2019-12-24 12:41:58

问题


Could anyone please tell me how could I implement the functionality of adjusting the volume on button click? Basically I am trying to put two buttons Volume Up and Volume Down but I couldn't find anyway to adjust the volume of button click. This link mentions about the MPVolumeView but I can't find it in my XCode 4.0 objects list and also I am not sure if I can use that for button click volume adjust. Could someone please point me in correct direction.


回答1:


If I'm understanding you correctly, your looking to have buttons to tell the iPhone to adjust the volume up or down. Although you may have better luck achieving this with a UIProgressView I would try playing around with something like this, either with multiple intended volumes each defined by the selected button, or create a variable and add or subtract from it in the ibaction ex myAudio.volume = x+.5;

...

  • (IBAction) VolumeOne { myAudio.volume = 1.0; }


来源:https://stackoverflow.com/questions/5789236/iphone-implement-volume-control-using-buttons

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!