Cocoa Programming for OS X: The Big Nerd Ranch Guide
by Aaron Hillegass, Adam Preble, Nate Chandler
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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access