有没有一种简单的方法来观察UITableView中的可见细胞?

Nic*_*rge 8 iphone cocoa-touch uitableview

我需要跟踪a中的可见单元格UITableView,因为当表示特定数据的单元格变得可见时,需要发生某些事件.UITableView似乎没有KVO兼容-indexPathsForVisibleRows或者-visibleCells,并且没有UITableViewDelegate方法可以通知可见细胞已经改变的通知.

有没有办法做到这一点,没有手动跟踪我自己的数组,每次插入/删除一行,重新加载表,或类似-tableView:cellForRowAtIndexPath:的方法添加/删除对象?

Swa*_*uke 5

UITableViewDelegate方法怎么样:

- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
Run Code Online (Sandbox Code Playgroud)


Nic*_*rge 1

如果不对 UITableView 或 UITableViewCell 进行黑客/子类化,答案似乎是否定的。