1
我试图加载我的表格视图与包含从互联网下载的图像的单元格。我只想对当前可见的单元格执行下载操作,而不是在用户快速向下滚动时下载每个图像。配置图像仅用于表视图上的可见行
我发现这个在浏览计算器,但它并没有太大的帮助:
- (void)configureVisibleCellsForTableView:(UITableView *)tableView animated:(BOOL)animated {
[self tableView:tableView configureRowsAtIndexPaths:tableView.indexPathsForVisibleRows animated:animated];
}
- (void)tableView:(UITableView *)tableView configureRowsAtIndexPaths:(NSArray *)indexPaths animated:(BOOL)animated {
for (NSIndexPath *indexPath in indexPaths) {
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
if (cell) {
[self tableView:tableView configureCell:cell forRowAtIndexPath:indexPath animated:animated];
}
}
}
- (void)tableView:(UITableView *)tableView configureCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath animated:(BOOL)animated {
// Cell configuration
}
什么来实现这个
您拍照时一看的tableView(_:willDisplayCell:forRowAtIndexPath:? - 这是一个CEL之前调用l是绘制的,如文档中所述 - https://developer.apple.com/library/ios/documentation/UIKit/Reference/UITableViewDelegate_Protocol/#//apple_ref/occ/intfm/UITableViewDelegate/tableView:willDisplayCell:forRowAtIndexPath: – Daven