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

Issues implementing [NSArrayController replaceObjectsAtArrangedObjectIndexes: withObjects:]


  • Subject: Issues implementing [NSArrayController replaceObjectsAtArrangedObjectIndexes: withObjects:]
  • From: Rob Petrovec <email@hidden>
  • Date: Tue, 25 Mar 2008 00:15:21 -0700

Hey,
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:

-[_NSControllerArrayProxy replaceObjectsAtIndexes:withObjects:]: unrecognized selector sent to instance 0x1e4ccf0

0x1e4ccf0 is the address 'currentObjects' points to. I've verified that 'objects' and 'currentObjects' contain the correct data and that the indexes being passed in are in the correct range. I also verified (via [currentObjects isKindOfClass:[NSMutableArray class]]) that 'currentObjects' is in fact an NSMutableArray. I'm creating the NSArrayController programmatically via [[NSArrayController alloc] initWithContent:nil] and adding objects to it via [NSArrayController addObject]. Essentially using the internal NSArray of the NSArrayController as my data source. Everything displays/updates correctly etc, it just balks on this block of code. Am I doing something wrong? Is there a better way to do this? Any ideas?

Thanks in advance...
_______________________________________________

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


  • Follow-Ups:
    • Re: Issues implementing [NSArrayController replaceObjectsAtArrangedObjectIndexes: withObjects:]
      • From: Keary Suska <email@hidden>
  • Prev by Date: Obtaining the foreground application's path
  • Next by Date: Alternate row colors and selection
  • Previous by thread: Re: Obtaining the foreground application's path
  • Next by thread: Re: Issues implementing [NSArrayController replaceObjectsAtArrangedObjectIndexes: withObjects:]
  • Index(es):
    • Date
    • Thread