I have an issue with bindings between an NSComboBox
element and an NSArrayController
.
All bindings are setup in IB.
The NSComboBox
element has the following bindings:
- Content: bound to the
NSArrayController
instance, key:arrangedObjects
- Content Values: bound to the
NSArrayController
instance, key:arrangedObjects.name
The NSArrayController
element is bound in the following way:
- Content Array: bound to
File's Owner
, key path:availableProperties
(which is anNSMutableArray
In the code, I have a method which is called when the window opens and after some event fires.
The code is the following:
NSMutableArray* newAvailable = ...; //compute the new properties to be displayed.
//now I want to replace all the properties with the new one
if ([self.availableProperties count] > 0)
[self.availablePropertiesController removeObjects:self.availableProperties];
[self.availablePropertiesController addObjects:newAvailables];
where self.availableProperties
is the NSMutableArray
(the model) and self.availablePropertiesController
is the NSArrayController
When the window opens the combo box is properly populated. But when the event fires I execute the above statements, I can see the backing array correctly filled, but the combo box is completely empty.
Some ideas?