• 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: Issues implementing [NSArrayController replaceObjectsAtArrangedObjectIndexes: withObjects:]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Issues implementing [NSArrayController replaceObjectsAtArrangedObjectIndexes: withObjects:]


  • Subject: Re: Issues implementing [NSArrayController replaceObjectsAtArrangedObjectIndexes: withObjects:]
  • From: Keary Suska <email@hidden>
  • Date: Tue, 25 Mar 2008 12:28:30 -0600
  • Thread-topic: Issues implementing [NSArrayController replaceObjectsAtArrangedObjectIndexes: withObjects:]

on 3/25/08 1:15 AM, email@hidden 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 (email@hidden)

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:

This email sent to email@hidden

References: 
 >Issues implementing [NSArrayController replaceObjectsAtArrangedObjectIndexes: withObjects:] (From: Rob Petrovec <email@hidden>)

  • Prev by Date: Re: Get root privileges with NSTask
  • Next by Date: Ephemeral Changes
  • Previous by thread: Issues implementing [NSArrayController replaceObjectsAtArrangedObjectIndexes: withObjects:]
  • Next by thread: Alternate row colors and selection
  • Index(es):
    • Date
    • Thread