UITableVIewCell重用 回收逻辑 及编写

小编

关注

阅读 31

2022-12-01


UITableVIewCell重用 回收逻辑 及编写

UITableVIewCell重用 回收逻辑 及编写_ide


代码中实现:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
UITableViewCell *uiTabCell = [tableView dequeueReusableCellWithIdentifier:@"name"];//系统回收池中取
if(!uiTabCell){//如没有 新建cell
uiTabCell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"name"];
}
uiTabCell.detailTextLabel.text = @"副标题";
uiTabCell.textLabel.text = @"主标题";
uiTabCell.imageView. image = [UIImage imageNamed:@"tab_purchasing_selector.png"];
return uiTabCell;
}

让我们的列表可以高效,快速的滑动,生成。


精彩评论(0)

0 0 举报