views:

93

answers:

1

I want to make my cell load and use it's data in reverse. Basically, I want the last cell to be the first.

+2  A: 

Do you mean you want to display your data from rail to head? Maybe you should perform it at your table's data source method:

- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
  ...
  NSUInteger row = [indexPath row];
  NSUInteger count = [listData count]; // here listData is your data source
  cell.textLabel.text = [listData objectAtIndex:(count-row-1)];
  return cell;
}
Elliot Chen
I think it should be (count-1-row).
DyingCactus
Hi, you're right. :) my mistake. I'll update that.
Elliot Chen
This will be accessing the opposite number in the data?
Jaba
I think so. If you use NSArray or its subclass to hold your data source. And also you can use 'reverseObjectEnumerator'. If you use other kind of data structures to hold your data, you need to use a corresponding 'reverse' accessing method.
Elliot Chen