Cocoa Programming for OS X: The Big Nerd Ranch Guide
by Aaron Hillegass, Adam Preble, Nate Chandler
Challenge: Convert RGBWell to Use Bindings
In Chapter 5 you used action methods to trigger manually updating the r, g, and b properties. Convert RGBWell to use bindings instead.
Here are some hints:
-
To be clear about what you are doing, state what bindings you need: “I want to bind the ‘R’ slider’s value attribute to the r property on MainWindowController.”
-
You have avoided creating an initializer for MainWindowController in order to inherit the initializer from NSWindowController. To continue to inherit this initializer, you will need to provide a default value for an NSColor property. You can do this with an NSColor class method. Return to the NSColor reference page to find one that works for the application.
-
When your ...