0
点赞
收藏
分享

微信扫一扫

UITableVIewCell重用 回收逻辑 及编写

小编 2022-12-01 阅读 31


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 条评论