Re: NSSortDescriptor not working with array of custom classes
Re: NSSortDescriptor not working with array of custom classes
- Subject: Re: NSSortDescriptor not working with array of custom classes
- From: Shawn Erickson <email@hidden>
- Date: Sun, 4 Nov 2007 17:07:46 -0800
On Nov 4, 2007, at 3:25 PM, Ken Tozier wrote:
On Nov 4, 2007, at 6:05 PM, Shawn Erickson wrote:
Can you post a complete code sample that shows the problem you are
reporting. We are having to guess at what your class(es) involved
really look like. You can simplify it down to some thing that shows
the issue you having.
That last post was pretty much where the problem is, but here's a
couple of other methods to flesh it in
- (void) sortPageViews
{
NSLog(@"pages before sortine: %@, class: %@", pages, [pages class]);
Which class is sortPageViews in? What does pages contain?
NSArray *sortedCells = [pages sortedArrayUsingDescriptors: desc];
[pages release];
pages = [[sortedCells mutableCopy] retain];
Why not use -[NSMutableArray sortUsingDescriptors] instead of the
above? Also in the above you copy and retain sortedCells so you are
ending up with an extra retain that isn't balanced by the one release
in the above.
-Shawn
_______________________________________________
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