Question

Really simple binding question. I have a checkbox on my MainMenu.xib, and I also have a text field and a date picker. I want to bind the hidden attribute of the field/picker to the checkbox such that if the box is checked the date picker is not hidden, and the text field is hidden.

Était-ce utile?

La solution

You'll want to do the following:

Checkbox -> Bind Value to your boolean.

Text Field -> Bind Hidden to same boolean.

Date Picker -> Bind Hidden to same boolean. Set its Value Transformer to NSNegateBoolean.

Here's a github project you can checkout for an example (everything is in the xib). https://github.com/macandyp/CocoaCheckBoxBindings

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top