on 3/25/08 1:15 AM, [EMAIL PROTECTED] purportedly said:

> Since NSArrayController does not have 'replace' functionality, I'm
> trying to implement my own for performance reasons.  Problem is, I
> keep getting an exception when my code runs.  Here is a code snippit:
> 
> - (void) replaceObjectsAtArrangedObjectIndexes:(NSIndexSet*)indexes
> withObjects:(NSArray*)objects
> {
> [self willChange:NSKeyValueChangeReplacement valuesAtIndexes: indexes
> forKey:@"arrangedObjects"];
> 
> NSMutableArray* currentObjects = [self
> mutableArrayValueForKey:@"arrangedObjects"];
> [currentObjects replaceObjectsAtIndexes:indexes withObjects:objects];
> 
> [self didChange:NSKeyValueChangeReplacement valuesAtIndexes:indexes
> forKey:@"arrangedObjects"];
> }
> 
> However, when [currentObjects replaceObjectsAtIndexes withObjects:] is
> called it throws this exception:

The short answer is that this approach is wrong in too many ways to
enumerate. In short, stick to the MVC pattern. Do this at the model level,
not the controller level. At the model level you can use essentially the
same code (but with naming changes).

Best,

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to