I have an inspector pane in my app that contains a bunch of controls. These controls are bound to my model objects through an NSArrayController
. Depending on what type of object is selected I am displaying a different set of inspectors (just like how IB works). The inspector controller observes the array controller's selection
, so that it can load the required set of inspectors when the selection changes.
The problem is that the old set of inspectors isn't removed apparently. Even through the inspector controller doesn't hold a strong reference to them and they are removed from their superview, they still stick around and log binding errors to the console:
[<Circle 0x102107df0> valueForUndefinedKey:]: this class is not key value
coding-compliant for the key width.
My guess is that the NSArrayController
holds a strong reference to the controls because of the bindings. Is this possible? Do I manually have to remove a binding before removing a control from the superview? How do I properly implement an inspector pane like this?
EDIT: The documentation says
Neither the receiver, nor anObserver, are retained.
so I guess bindings should be removed automatically when removing the control, shouldn't it?