iPhone:使用按钮实现音量控制 [英] iPhone: Implement Volume control using buttons
问题描述
任何人都可以告诉我如何实现单击按钮时调节音量的功能吗?基本上,我试图将两个按钮的音量调高和音量调低,但我还是找不到调整按钮点击音量的方法.此链接提到了有关MPVolumeView的内容,但我在XCode中找不到它4.0对象列表,而且我不确定是否可以将其用于按钮单击音量调整.有人可以指出正确的方向.
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.
推荐答案
如果我对您的理解正确,那么您希望使用按钮告诉iPhone调高或调低音量.尽管通过UIProgressView实现这一点可能会更好一些我会尝试使用类似的方法,要么在选定的按钮中定义多个预期的音量,要么创建一个变量,然后在ibaction ex myAudio.volume = x + .5;
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;}
这篇关于iPhone:使用按钮实现音量控制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!