在自定义UITableViewCell,需要给它增加子视图
static NSString *cellID = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
if (!cell) {
cell = [[UITableViewCell alloc]initWithStyle:(UITableViewCellStyleDefault) reuseIdentifier:cellID];
}
##需要给cell添加子视图,你会选择哪种:
1. [cell addSubview:子视图];
2. [cell.contentView addSubview:子视图];
子视图是一个红色的UILabel,字体随便
在表视图普通模型下,他们没有区别,如图
Simulator Screen Shot 2016年8月4日 14.40.39.png
在表视图编辑模型下,1没有变化, 2右移了,如图
Simulator Screen Shot 2016年8月4日 14.40.41.png