What does “Controller Key” mean in Interface Builder > Inspector > Bindings?

后端 未结 4 1807
温柔的废话
温柔的废话 2021-01-03 00:33

I can\'t find in the Docs where they explain all those fields and what they mean. Especially \"Controller Key\" is not clear to me.

4条回答
  •  误落风尘
    2021-01-03 01:02

    It has to do with key-value coding. You can bind a control in IB to a value in your controller. To connect that value, you have to specify the keypath to it. For example, if you have a textfield in IB and you want to bind it to say a field called 'name' in your controller, you would specify 'name' as the keypath. You then need to set up your name field in your controller to be accessible through key-value coding. This is done in 10.5 by using the @property and @synthesize specifiers.

提交回复
热议问题