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

2018-07-25  本文已影响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];

    }

}

上一篇 下一篇

猜你喜欢

热点阅读