Cocoa binding problem/bug - setKeys not inherited?
Cocoa binding problem/bug - setKeys not inherited?
- Subject: Cocoa binding problem/bug - setKeys not inherited?
- From: Brett Powley <email@hidden>
- Date: Fri, 4 Jun 2004 11:09:54 +1000
Hi all,
In my first non-trivial Cocoa application, I have run into an issue
which seems to be either a bug or a feature which ought to be
documented somewhere. (Preferably documented in 14 point bright red
text on Apple's home page, given the amount of sleep I have lost over
the last week trying to track this down!)
I have a superclass with some keys and dependent keys. In the
superclass +initialize method, I have used setKeys to get notifications
for dependent keys:
[MySuperclass setKeys:
[NSArray arrayWithObjects:@"termIndexLevel1", nil]
triggerChangeNotificationsForDependentKey:@"termsAtLevel2"];
The problem is that subclasses of this superclass do not seem to get
the notifications. I need to repeat this code (but using MySubclass)
in the +initialize method of each subclass (even though the keys
strictly belong to the superclass):
[MySubclass setKeys:
[NSArray arrayWithObjects:@"termIndexLevel1", nil]
triggerChangeNotificationsForDependentKey:@"termsAtLevel2"];
I did try to use [self class] rather than the class name in the
superclass to see if that made a difference:
[[self class] setKeys:
[NSArray arrayWithObjects:@"termIndexLevel1", nil]
triggerChangeNotificationsForDependentKey:@"termsAtLevel2"];
but that doesn't seem to work either.
Incidentally, "not working" means that a popup menu in Interface
Builder whose contents are bound to "termsAtLevel2" (an NSArray*) does
not get updated.
Is this behaviour what I should be expecting? Are +initialize methods
inherited by subclasses? Should a setKeys done in a superclass apply
to subclasses too?
Cheers,
Brett Powley
--------------------------------------------------------------
Process Software
PO Box U333, University of Wollongong, NSW 2500, Australia
WWW:
http://www.process.com.au
It's already tomorrow in Australia.
--------------------------------------------------------------
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.