Re: Sorting with NSNull's ???
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