题
我试图获得一个UISlider同的音量键。我已经成功地使用的滑改变系统/铃声音量,但是我要滑块移动的时候摇动。任何建议,关于如何获得流量的价值?我使用的代码如下monnitor量的变化:
- (void)volumeChanged:(NSNotification *)notification{
AVSystemController* avc = SharedAVSystemController;
// my sliders name is customVolume, and this is how I
// am trying to get the volume:
customVolume.value = [avc getVolume:(float *) forCategory:(id)];
}
此外,什么是AVSystemController类别"的铃声"?
解决方案 2
这将更新theUISlider
with音量键:
- (void)volumeChanged:(NSNotification *)notification
{
AVSystemController *avs = [ notification object ];
NSString *audioDeviceName;
[ avs getActiveCategoryVolume:&_volume andName:&audioDeviceName ];
}
其他提示
有一类,可在SDK处理系统的体积都通过本身, MPVolumeView.这不是一个子类的 UISlider
因此你不能改变它的外观(那么,这将是很难的黑客一起通过自己的所有),但这可能不是一个问题。(编辑: 看 类垃圾堆, ,图包含一个正常的 UISlider
图,因此它可以更容易比我预期的)
我不确定是否它处理你的一切需要,并如果它会适合你的上下文,但你也可以看一看它和尝试。
不隶属于 StackOverflow