iOS- 取消tableviewcell左侧15像素线条

96
malgee
2016.12.19 17:40* 字数 34

在放tableview的控制器里面添加下面代码就 OK 了,如图 image 中所示,下图是tableviewcell截图示范

-(void)viewDidLayoutSubviews
{
    if ([self.displayTableview respondsToSelector:@selector(setSeparatorInset:)]) {
        [self.displayTableview setSeparatorInset:UIEdgeInsetsMake(0,0,0,0)];
    }
    if ([self.displayTableview respondsToSelector:@selector(setLayoutMargins:)]) {
        [self.displayTableview setLayoutMargins:UIEdgeInsetsMake(0,0,0,0)];
    }
}
-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
    if ([cell respondsToSelector:@selector(setSeparatorInset:)]) {
        [cell setSeparatorInset:UIEdgeInsetsZero];
    }
    if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {
        [cell setLayoutMargins:UIEdgeInsetsZero];
    }
}

image.png
【iOS 笔记】
Web note ad 1