我正在使用这种方法以编程方式设置音量设备:
self.mpVolumeView.frame = CGRectMake(0, 0, self.view.bounds.width * 0.82, CGFloat(50))
self.mpVolumeView.showsRouteButton = false
self.mpVolumeView.showsVolumeSlider = true
self.mpVolumeView.backgroundColor = UIColor.clearColor()
for subview in self.mpVolumeView.subviews {
if (subview as UIView).description.rangeOfString("MPVolumeSlider") != nil {
// Set volume
volumeSlider = subview as UISlider
subview.setValue(0.5, animated: false)
break
}
}
这工作正常,但每次我设置滑块值时,音量 hud 都会出现,有没有办法防止这种情况?