Check if a specific UITableViewCell is visible in a UITableView

You can use the UITableView method:

[tableView indexPathForCell:aCell];

If the cell doesn't exist in the tableView it will return nil. Otherwise you will get the cell's NSIndexPath.


if ([tableView.visibleCells containsObject:myCell])
{
    // Do your thing
}

This assumes that you have a separate instance variable containing the cell you are interested in, I think you do from the question but it isn't clear.


Note that you can as well use indexPathsForVisibleRows this way:

    NSUInteger index = [_people indexOfObject:person];
    NSIndexPath *indexPath = [NSIndexPath indexPathForRow:index inSection:0];
    if ([self.tableView.indexPathsForVisibleRows containsObject:indexPath]) {
      [self.tableView reloadRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] 
                            withRowAnimation:UITableViewRowAnimationFade];
    }

If you have the indexPath (and don't need the actual Cell) it might be cheaper.

PS: _people is the NSArray used as my backend in this case.