Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to update live NSSlider value?

Tags:

xcode

swift

cocoa

I have slider with volume value. I need changed volume in live. Whats 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
}
like image 1000
cmashinho Avatar asked Apr 21 '15 09:04

cmashinho


1 Answers

If you set Continuous in the properties of Interface Builder you get permanent updates of the slider value:

enter image description here

like image 198
qwerty_so Avatar answered Sep 22 '22 03:09

qwerty_so