Home > Mobile >  How to set NSSlider value in a NSToolbar - Swift Cocoa Storyboard
How to set NSSlider value in a NSToolbar - Swift Cocoa Storyboard

Time:06-29

I am quite new to Swift programming and I am trying to set a slider min, max and value in a NSToolbar. As an hypothetical exemple, I have a list of client and I want to use the slider in the toolbar to select a client data page. I will firt to load the client database in the NSViewController and count the number of client. Than I would like to set the slider in the toolbar minvalue to 1 and maxvalue to the number of client. I understand how to send slider values from the Windowcontroller to the ViewController but I did not found how to do the inverse , how to send data from the Viewcontroller to the Window controller in order to set the slider values. I have attach an simple code based on this exemple Slider value binding

In the view is a label with a number formatter. The value of the label is bound to the View Controller, key path count.

Label value binding

The window controller isn't subclassed.

  • Related