How to update the current value of NSSlider?

I have a slider with volume. I need to change the volume live. What is wrong in my code?

@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 } 
+6
source share
1 answer

If you set Continuous in the Interface Builder properties, you will get a constant update of the slider value:

enter image description here

+7
source

Source: https://habr.com/ru/post/985584/


All Articles