Unbinding NSArrayController's contentArray
Unbinding NSArrayController's contentArray
- Subject: Unbinding NSArrayController's contentArray
- From: Antonio Nunes <email@hidden>
- Date: Wed, 7 Mar 2007 23:20:06 +0000
Hi,
According to Apple docs:
In order to programmatically de-couple a controller from a content
object that is bound to contentObject, contentArray or contentSet,
you must break the binding connection and set the controller’s
content to nil.
[theController unbind:@"contentArray"];
[theController setContent:nil];
I want to temporarily unbind a controller from its source array,
change the array's contents and re-establish the binding. The
problem is that the above recipe doesn't seem to work:
[blabla…]
[myArrayController unbind:@"contentArray"];
[ myArrayController setContent:nil];
[loop adding objects to the array to whom the binding is supposed to
be severed…]
[ myArrayController bind:@"contentArray"
toObject:self
withKeyPath:@"sourcePages"
options:bindingOptions];
[blabla…]
A tableview is using the array controller as its source (through
columns bound in IB). I would expect it not to be updated each
iteration through the loop since the controller would not be
observing the source array (being updated in the loop) after severing
the bind. But I happily see the tableView updating as the loop
progresses. Am I overlooking something? Ploughing through 12 pages of
Cocoabuilder archives on the query "unbind" and some other related
queries didn't turn up any solutions/hints/tips.
I suppose I could do the extra work and unbind the tableView's
columns instead (assuming that would work), but it would seem cleaner
and more efficient to do it this way. Any comments on that?
Best,
António
-----------------------------------------
Forgiveness is not an occasional act;
it is a permanent attitude.
--Martin Luther King, Jr
-----------------------------------------
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden