Flipkart Search

Search This Blog

Friday, September 24, 2010

Reverse objects of an NSArray/NSMutableArray easily

Here is an example of reversing a NSArray/NSMutableArray

    NSString *string = @"a,b,c,d,e,f,g,h,i,j,k";
    NSArray *array = [string componentsSeparatedByString:@","];
    NSLog(@"array = %@",array);
    NSArray* reversedArray = [[array reverseObjectEnumerator] allObjects];
    NSLog(@"Reverse array = %@",reversedArray);



Happy coding all iPhone coderz