TableView cell 分割线 的 设置

设置 tableview cell 的分割线距离左右2 边的位置  (上,左,右,下) (0,0,0,0)表示顶到2端

-(void)viewDidLayoutSubviews

{

    if ([self.friendTableView respondsToSelector:@selector(setSeparatorInset:)]) {

        [self.friendTableView setSeparatorInset:UIEdgeInsetsMake(0,0,0,0)];

    }

    if ([self.friendTableView respondsToSelector:@selector(setLayoutMargins:)]) {

        [self.friendTableView setLayoutMargins:UIEdgeInsetsMake(0,0,0,0)];

    }

}

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

{

    if ([cell respondsToSelector:@selector(setSeparatorInset:)]) {

        [cell setSeparatorInset:UIEdgeInsetsMake(0,15,0,15)];

    }

    if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {

        [cell setLayoutMargins:UIEdgeInsetsMake(0,15,0,15)];

    }

}

原文地址:https://www.cnblogs.com/allenChan/p/4959193.html