Sorting an NSArray with raw NSString objects

/ Published in: Objective C
Save to your folder(s)

Copy this code and paste it in your 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];

URL:[email protected]/msg09385.html

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.