• 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: NSSortDescriptor not working with array of custom classes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Re: NSSortDescriptor not working with array of custom classes (From: Ken Tozier <email@hidden>)
 >Re: NSSortDescriptor not working with array of custom classes (From: Shawn Erickson <email@hidden>)
 >Re: NSSortDescriptor not working with array of custom classes (From: Ken Tozier <email@hidden>)

  • Prev by Date: Re: FYI - installer packages are the preferred deployment method now
  • Next by Date: [Solved] Re: Custom editable cell on NSOutlineView
  • Previous by thread: Re: NSSortDescriptor not working with array of custom classes
  • Next by thread: Buttons stopped responding to clicks
  • Index(es):
    • Date
    • Thread