我有带音量值的滑块。我需要改变音量。我的代码有什么问题?
@IBOutlet weak var volumeSliderCurr: NSSlider!
@IBAction func volumeSlider(sender: AnyObject) {
var event: NSEvent = NSApplication.sharedApplication().currentEvent!
mouseUp(event)
}
override func mouseUp(theEvent: NSEvent) {
super.mouseUp(theEvent)
audioPlayer.volume = volumeSliderCurr.floatValue
currVolume = volumeSliderCurr.floatValue
}
答案 0 :(得分:7)
如果在Interface Builder的属性中设置Continuous
,则会获得滑块值的永久更新: