O'Reilly logo

Cocoa Programming for OS X: The Big Nerd Ranch Guide by Aaron Hillegass, Adam Preble, Nate Chandler

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required