- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *cellID = @"cellid";
AotuTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
if (!cell) {
[tableView registerNib:[UINib nibWithNibName:@"AotuTableViewCell" bundle:nil] forCellReuseIdentifier:cellID];
// NSLog(@"%ld",++i);
cell = [tableView dequeueReusableCellWithIdentifier:cellID];
}
return cell;
}简单的几行经常忘!!!记下来
iOS 开发 自定义 xibcell 重用
最新推荐文章于 2022-04-21 19:00:00 发布
本文介绍了一个常见的UITableView单元格重用技巧。通过注册单元格和检查是否为空来有效地重用UITableViewCell,减少内存消耗并提高UITableView滚动时的性能。
488

被折叠的 条评论
为什么被折叠?



