Re: NSMutableArray comparator; sorting on insert
Re: NSMutableArray comparator; sorting on insert
- Subject: Re: NSMutableArray comparator; sorting on insert
- From: Matt Gough <email@hidden>
- Date: Fri, 16 Jan 2009 17:39:45 +0100
On 16 Jan 2009, at 17:27, David Harper wrote:
Hello,
I have written a comparator that returns an NSComparisonResult based
on the comparison of two objects as required for
[(NSMutableArray *)someArray
sortUsingSelector:@selector(theSelector:)]
Now, I want this array to remain sorted after each insert. For now
I am inserting, then sorting, but this is not ideal. Is there a way
to perform an insert using the same selector to find the correct
index before inserting?
_______________________________________________
Your might want to use :
- (NSArray *)sortedArrayUsingFunction: context: hint:
and
- (NSData *)sortedArrayHint
Matt Gough
_______________________________________________
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