質問

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.

役に立ちましたか?

解決

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

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top