美文网首页
2018-07-24关于tableview的一些操作

2018-07-24关于tableview的一些操作

作者: 北你妹的风 | 来源:发表于2018-07-25 16:44 被阅读10次

1、设置cell离左边视图的距离

tempTableView.separatorInset=UIEdgeInsetsMake(0, 20, 0, 0);//距离左侧20pt

2、设置tableview 没有分割线

tempTableView.separatorStyle= UITableViewCellSeparatorStyleNone

3、table为group类型时,消除顶部一段间隔

- (CGFloat)tableView:(UITableView*)tableView heightForHeaderInSection:(NSInteger)section{

    return0.1;

}

-(UIView*)tableView:(UITableView*)tableView viewForHeaderInSection:(NSInteger)section{

    return  [[UIView alloc] initWithFrame:CGRectZero];

}

4、设置cell 下行线的左侧边距为零

-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath

{

    if([cellrespondsToSelector:@selector(setSeparatorInset:)]) {

                [cellsetSeparatorInset:UIEdgeInsetsZero];

    }

}

相关文章

网友评论

      本文标题:2018-07-24关于tableview的一些操作

      本文链接:https://www.haomeiwen.com/subject/trtmmftx.html