Re: Sorting an NSArray
Re: Sorting an NSArray
- Subject: Re: Sorting an NSArray
- From: Andy Lee <email@hidden>
- Date: Thu, 30 Jun 2005 01:46:48 -0700
On Jun 30, 2005, at 1:27 AM, Andy Lee wrote:
Example:
NSArray *sortedArray =
[oldArray sortedArrayUsingSelector:@selector(name)];
Oops, that isn't right. The selector you pass is supposed to be a
comparison method, which is not what -name is. What you should do is
write a comparison method in your object class, and pass the selector
for that method.
It's probably clearer if you check out the docs mmalcolm pointed to.
--Andy
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden