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
    );
}
posted @ 2015-11-06 16:05  逆时光  阅读(610)  评论(0编辑  收藏  举报