Search code examples
cocoacocoa-bindingsnscollectionview

Binding to both the checked state and string value of NSCheckBoxes in an NSCollectionView


I need to create an NSCollectionView which contains NSCheckBoxes. When I do this for something like labels I can bind to the control's value. But when dealing with NSCheckBoxes I need to bind to both its value (checked or unchecked) and it's text string.

I'm don't understand how I can bind two different attributes of an NSCheckBox. Am I going about this the wrong way?


Solution

  • A checkbox has both a "Value" binding, which is the state of the checkbox (checked, unchecked, or mixed) and a "Title" binding, which is the label string. You can bind each independently, which is what you want.