Re: NSArrayController selection bug?
Re: NSArrayController selection bug?
- Subject: Re: NSArrayController selection bug?
- From: Scott Anguish <email@hidden>
- Date: Tue, 11 Nov 2003 20:37:00 -0500
this of course will break cases where it's not the contents of the
array you want, but the reference to the array. Generally, this is
just a horrible work around.
It'd be better to consider implementing the indexed accessor methods
for the property that contains the array... then use those for
accessing the contents of the array exclusively.
<
http://developer.apple.com/documentation/Cocoa/Conceptual/
KeyValueCoding/Concepts/AccessorConventions.html#//apple_ref/doc/uid/
20002174/BAJEDEFB>
On Nov 11, 2003, at 6:09 PM, Henrik Wittland wrote:
@implementation YourModelClass_or_YourModelRootClass
(NSArrayControllerSelectionFixForBehindTheScenesObjectRemoval)
-(id)valueForKey:(NSString *)key {
id value = [super valueForKey:key];
if ([value isKindOfClass:[NSArray class]]) {
return [NSArray arrayWithArray:(NSArray *)value];
} else {
return value;
}
}
@end
You can easily remove this category after the problem gets fixed.
Apple teaches us to not overwrite valueForKey: but this is a
workaround.
_______________________________________________
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.