Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Boggled By Bindings




On Sep 30, 2004, at 4:14 PM, Scott Stevenson wrote:

On Sep 30, 2004, at 3:55 PM, Jacob Lukas wrote:

I had the same problem recently. What I found that works is using:
[self addObserver:self forKeyPath:@"arrangedObjects" options:nil context:nil];
in awakeFromNib and
[self removeObserver:self forKeyPath:"];
in dealloc. Then implement:

- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
{
if (keyPath == ")
[self didChangeValueForKey:@"ivar"];
[super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
}

You could probably do the same by just overriding -arrangedObjects and doing the manual change notification in there.

I believe -arrangedObjects is called when another object wants the arranged objects, not when the arranged objects are changed. I could be wrong, though.

Jacob
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden

References: 
 >Boggled By Bindings (From: Patrick Machielse <email@hidden>)
 >Re: Boggled By Bindings (From: Jacob Lukas <email@hidden>)
 >Re: Boggled By Bindings (From: Scott Stevenson <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.