What's the Difference between “Content Values” and “Content Objects”

前端 未结 2 829
灰色年华
灰色年华 2021-01-30 11:38

I\'m exploring bindings right now, and have an NSPopUpButton -

It presents me a number of options for bindings under Value Selection - Content, Conte

2条回答
  •  野的像风
    2021-01-30 12:13

    #Object refers to any KVC-compliant object. #ObjectValue refers to the key path used to get the value from that object.

    So, for your pop-up binding, ContentObjects would be bound to, say, an NSArrayController's arrangedObjects. Say this refers to an array of dictionaries or managed objects. You can't meaningfully present a dictionary in a pop-up (you get the start of the description output, e.g or similar), so this is where the contentValues binding comes in. This would be something like your NSArrayController's arrangedObjects.name, where name is a key from your dictionary or managed object.

    I hope this helps, I struggled with the same concept myself when I started with bindings.

提交回复
热议问题