Reputation: 1409
Basically I want to check whether a cell in a UITableView has been loaded/viewed before so I can perform an animation on the first view of the cell. Does anyone know how I would go about doing this?
I'm guessing this is probably a backwards way of doing this, if you can think of a nicer way of checking then i'm all ears.
Thanks in advance!
Upvotes: 4
Views: 898
Reputation: 21882
You should trigger the animation and keep track of which index paths have been displayed already in the tableView:willDisplayCell:forRowAtIndexPath:
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
// NSMutableSet *animatedIndexPaths; <-- this is an ivar.
if (![animatedIndexPaths containsObject:indexPath])
{
[animatedIndexPaths addObject:indexPath];
// Trigger your cell animation on cell.
}
}
Upvotes: 6