I want to make my cell load and use it's data in reverse. Basically, I want the last cell to be the first.
For performance reasons, a table view's data source should generally reuse UITableViewCell objects when it assigns cells to rows in its tableView(_:cellForRowAt:) method. A table view maintains a queue or list of UITableViewCell objects that the data source has marked for reuse.
So, to remove a cell from a table view you first remove it from your data source, then you call deleteRows(at:) on your table view, providing it with an array of index paths that should be zapped. You can create index paths yourself, you just need a section and row number.
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;
}
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