I want to display data in UITableView in reverse order. I manage to do it with little effort but can any one provide a better way to do it. Thanks in advance.
Use -[NSArray reverseObjectEnumerator]
:
NSArray * a = [NSArray arrayWithObjects:@"a", @"b", @"c", nil];
NSArray * reverse = [[a reverseObjectEnumerator] allObjects];
NSLog(@"%@", reverse); //logs "c, b, a"
Well i dont know what your code is but you can do something like this
cell.title = [anarray objectAtIndex:(anarray.count - indexPath.row - 1)];
Hope this may works. Cheers.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With