views:

32

answers:

2

I need to keep track of the visible cells in a UITableView, since certain events need to occur when cells that represent specific pieces of data become visible. UITableView doesn't seem to be KVO compliant for -indexPathsForVisibleRows or -visibleCells, and there's no UITableViewDelegate method that gives a hook for being notified that the visible cells have changed.

Is there any way of doing this, short of manually keeping track of my own array, and adding/removing objects every time I insert/remove a row, reload the table, or methods like -tableView:cellForRowAtIndexPath: are called?

A: 

How about UITableViewDelegate method:

- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
lukya
From what I can tell `UITableView.visibleCells` is updated _after_ this method is called, so it doesn't help solve this particular problem.
Nick Forge