Frage

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.

War es hilfreich?

Lösung

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

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top