• 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 content array vs arrangedObjects
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSArrayController content array vs arrangedObjects


  • Subject: Re: NSArrayController content array vs arrangedObjects
  • From: Keary Suska <email@hidden>
  • Date: Fri, 20 Jul 2007 08:28:10 -0600
  • Thread-topic: NSArrayController content array vs arrangedObjects

on 7/19/07 10:31 PM, email@hidden purportedly said:

> Problem: I  am trying to accomplish bulk deletes and (re)insertions into an
> NSArrayController/bound ivar.
>
> I have a NSTableView bound to an NSArrayController's content:arrangedObjects,
> selectionIndexes, and sortDescriptors (each column is bound to a key in an
> ivar). The NSArrayController is bound to an NSMutableArray ivar in an
> NSDocument subclass.
> I was looking at mmalc's bookmarks example of programmatically bulk updating
> an ivar:
>
> So i simply call a method on my ivar:
>
> - (void)removeObjectsInTheFooAtIndexes:(NSIndexSet *)indexes
> {
> [self willChange:NSKeyValueChangeRemoval valuesAtIndexes:indexes
>  forKey:@"theFoo"];
> [[self theCues] removeObjectsAtIndexes:indexes];
> [self didChange:NSKeyValueChangeRemoval valuesAtIndexes:indexes
> forKey:@"theFoo"];
> }
>
>
> however, I am having the damnedest time specifying an IndexSet to remove from
> the ivar. It seems that the [NSArrayController selectionIndexes] returns an
> NSIndexSet from the arrangedObjects array and not the contentArray. Since my
> ivar matches the contentArray(?) whenever I delete something in my ivar, I am
> deleting the wrong items.

Actually, there was a discussion on a related topic just this last week.
What about using -removeObjectsInArray: and passing the result of the
controller's -selectedObjects ?

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: 
 >NSArrayController content array vs arrangedObjects (From: email@hidden)

  • Prev by Date: Re: beginSheet, doesn't stop NSThread
  • Next by Date: NSUserdefaultsController warning
  • Previous by thread: NSArrayController content array vs arrangedObjects
  • Next by thread: Message dialog on Cocoa
  • Index(es):
    • Date
    • Thread