views:

21

answers:

1

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!

A: 

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.
    }
}
Daniel Dickison
Awesome! Got it implemented and working within 5 minutes. Cheers for your help!
AndyDev
@AndyDev: if it works, please 'accept' the answer so it can help others with the same question. Thanks!
Daniel Dickison