Re: NSArrayController content array vs arrangedObject
Re: NSArrayController content array vs arrangedObject
- Subject: Re: NSArrayController content array vs arrangedObject
- From: Keary Suska <email@hidden>
- Date: Fri, 20 Jul 2007 13:54:51 -0600
- Thread-topic: NSArrayController content array vs arrangedObject
on 7/20/07 12:59 PM, email@hidden purportedly said:
> And it works fine. My only concern with this approach is that I
> imagine that the time it takes to remove n amount of items increases
> with the number of the objects you want to delete. The documentation
> says that removeObjectsInArray looks for each item in the array and
> removes it, so I imagine that it could get slow.
Possibly. You may want to run tests to compare it to the old-fashioned
"remove" accessor. I don't know what NSArrayController does internally to
map indexes (see below), so I don't know which would really be faster
> This is approach I will use right now, but I am bothered somewhat
> that I can't understand how to retrieve an underlying IndexSet for
> the contenArray.
This was the nature of the recent discussion. In a nutshell, any time you
sort the display of an array in an NSTableView et al., the original "model"
array is not changed. Therefore, the display selected indexes may not
correspond to the model array. The only way to guarantee this is to sort the
model array whenever the "display" is sorted. How you do this depends on how
you are implementing sorting.
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