TableView行缩进 自定义cell时候

TableView行缩进
-(NSInteger)tableView:(UITableView *)tableView indentationLevelForRowAtIndexPath:(NSIndexPath *)indexPath{
   
  return indexPath.row + 10;
   
}
如果是自定义cell  需要在cell中重写这个方法
- (void)layoutSubviews
{
    [super layoutSubviews];
    float indentPoints = self.indentationLevel * self.indentationWidth;
 
    self.contentView.frame = CGRectMake(
        indentPoints,
        self.contentView.frame.origin.y,
        self.contentView.frame.size.width - indentPoints, 
        self.contentView.frame.size.height
    );
}
原文地址:https://www.cnblogs.com/gaojingxuan/p/4942901.html