Monday, 5 January 2015

Sorting NSMutableArray

  NSMutableArray *myColors = [NSMutableArray arrayWithObjects: @"red", @"green", @"blue", @"yellow", nil];
    
    NSArray *sortedArray;
    
    sortedArray = [myColors sortedArrayUsingSelector:@selector(localizedCaseInsensitiveCompare:)];
    

    myColors = [NSMutableArray arrayWithArray:sortedArray];

No comments:

Post a Comment