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

For the More Curious: NSValueTransformer

Bindings read values from objects. Sometimes, a value will need some massaging before it can be used. To fulfill this purpose, Apple created NSValueTransformer. One example is NSNegateBoolean, which transforms true into false, and false into true.

The Hidden binding on views in Interface Builder is very convenient, as long as you are binding to a Bool that is true when you want the view hidden. If your Bool is true for shown, you can simply enter NSNegateBoolean in the Value Transformer field of the bindings inspector. No need to jump through hoops to create a bindings-compliant Bool for the inverse.

You can create your own NSValueTransformer subclasses and attach them to bindings in 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