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
2010-05-11 02:26:08
I think it should be (count-1-row).
DyingCactus
2010-05-11 02:39:28
Hi, you're right. :) my mistake. I'll update that.
Elliot Chen
2010-05-11 02:41:20
This will be accessing the opposite number in the data?
Jaba
2010-05-11 03:03:28
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
2010-05-11 03:41:15