문제

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