我对 indexPath 和 indexPath.row 感到困惑,tableView 的每个单元格是否对应一个 indexPath?那么我们为什么要寻找这个 indexPath 的“行”呢?我检查了文档,但我认为它让我感到困惑。
我找到了这段代码:
// this method is used in case the user scrolled into a set of cells that don't have their app icons yet
- (void)loadImagesForOnscreenRows
{
if ([self.entries count] > 0)
{
NSArray *visiblePaths = [self.tableView indexPathsForVisibleRows];
for (NSIndexPath *indexPath in visiblePaths)
{
AppRecord *appRecord = [self.entries objectAtIndex:indexPath.row];
if (!appRecord.appIcon) // avoid the app icon download if the app already has an icon
{
[self startIconDownload:appRecord forIndexPath:indexPath];
}
}
}
}
你能解释一下两者之间的区别吗?
非常感谢
保罗