• 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 with NSNull's ???
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Sorting with NSNull's ???


  • Subject: Re: Sorting with NSNull's ???
  • From: "R. Matthew Emerson" <email@hidden>
  • Date: Sat, 23 Sep 2006 19:33:43 -0400


On Sep 23, 2006, at 3:37 PM, John Webb wrote:

My TableView displays info pulled from a DB and I use the NSNull singleton to represent null DB values. I must maintain/allow null values for when I write any edited data back to the DB.

I was extremely surprised that compare: (or NSMutableArray sortUsingDescriptors: , which is the actual method I'm using in my data source implementation ) didn't check for or recognize NSNull values. It seems like sorting arrays with NSNull values would be extremely common and handled transparently by Cocoa.


Instead of sortUsingDescriptors:, why not use sortUsingFunction:context:? You've already basically written the comparison function that handles NSNull the way you want. You'd only need to recast it into plain C.


You'd avoid the cumbersome use of the category that way.



_______________________________________________
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 with NSNull's ??? (From: John Webb <email@hidden>)

  • Prev by Date: Re: Sorting with NSNull's ???
  • Next by Date: Detecting a focus change in a window?
  • Previous by thread: Re: Sorting with NSNull's ???
  • Next by thread: Detecting a focus change in a window?
  • Index(es):
    • Date
    • Thread