• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSArrayController selection bug?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

References: 
 >NSArrayController selection bug? (From: Jesse Grosjean <email@hidden>)
 >Re: NSArrayController selection bug? (From: mmalcolm crawford <email@hidden>)
 >Re: NSArrayController selection bug? (From: Jesse Grosjean <email@hidden>)
 >Re: NSArrayController selection bug? (From: mmalcolm crawford <email@hidden>)
 >Re: NSArrayController selection bug? (From: Henrik Wittland <email@hidden>)
 >Re: NSArrayController selection bug? (From: mmalcolm crawford <email@hidden>)
 >Re: NSArrayController selection bug? (From: Henrik Wittland <email@hidden>)

  • Prev by Date: XCode not releasing nsstring
  • Next by Date: Re: itunes for windows HOWTO ???
  • Previous by thread: Re: NSArrayController selection bug?
  • Next by thread: Re: NSArrayController selection bug?
  • Index(es):
    • Date
    • Thread