Posted By

arpit on 05/25/09


Tagged

iphone


Versions (?)

Sorting an NSArray with raw NSString objects


 / Published in: Objective C
 

URL: http://www.mail-archive.com/[email protected]/msg09385.html

  1. NSArray* allResteraunts = [[NSArray alloc] initWithObjects:@"Peiking", @"AHotel", @"BHotel", nil];
  2. NSSortDescriptor *desc = [[NSSortDescriptor alloc] initWithKey:nil ascending:YES selector:@selector(localizedCompare:)];
  3. NSArray *sortedArray = [allResteraunts sortedArrayUsingDescriptors:[NSArray arrayWithObject:desc]];
  4. [desc release];

Report this snippet  

You need to login to post a comment.