UITableVIewCell重用 回收逻辑 及编写
代码中实现:
- (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;
}
让我们的列表可以高效,快速的滑动,生成。