Search code examples
objective-ccocoabindingkey-value-observingnsarraycontroller

Binding to NSArrayController's arrangedObjects shows an open parenthesis


I have an NSArrayController bound to my mutable model array via its contentArray binding. And I have a few controls (like an inspector) where I want to show some of the properties of the objects in my array. I bound the controls' value to arrangedObjects.property of my NSArrayController.

When I add an object to my model array, all the controls show a single opening parenthesis (. If I bind the controls to selection.property instead and make the NSArrayController select all the objects all the time, it works. But I was wondering why it didn't work with arrangedContent? Do you have any idea?


Solution

  • What controls are you binding to the array controller? The various controls do different things with their bindings.

    The open parenthesis is the first line of an array's description. The control is expecting a string and is obtaining one from the bound thing by invoking -description.