• 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: Sorting an NSArray
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Sorting an NSArray


  • Subject: Re: Sorting an NSArray
  • From: Andy Lee <email@hidden>
  • Date: Thu, 30 Jun 2005 02:04:10 -0700

On Jun 30, 2005, at 1:53 AM, j o a r wrote:
On 30 jun 2005, at 10.46, Andy Lee wrote:
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.


Stop to think if you really need to write a custom comparison method - it's probably only necessary if you need to compare non- object values or perform a compound comparison between several attributes. The question asked in the first message in this thread didn't give that impression.

Hm, taking a hint, I've discovered NSSortDescriptor, which I can now use myself since I'm no longer supporting Jaguar in my app. (I'll have to check whether it buys me anything.)


I won't try to explain NSSortDescriptor at this hour, for fear of embarrassing myself -- I'll just repeat the advice to see the docs and post again if they're not clear.

Thanks.

--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
References: 
 >Sorting an NSArray (From: Duncan Campbell <email@hidden>)
 >Re: Sorting an NSArray (From: Andy Lee <email@hidden>)
 >Re: Sorting an NSArray (From: Andy Lee <email@hidden>)
 >Re: Sorting an NSArray (From: j o a r <email@hidden>)

  • Prev by Date: How to build split pane outline or table view?
  • Next by Date: Re: How to get information from the download manager?
  • Previous by thread: Re: Sorting an NSArray
  • Next by thread: How to build split pane outline or table view?
  • Index(es):
    • Date
    • Thread