TableViewCell左边部分的线缺少一部分的解决办法



TableViewCell左边部分的线缺少一部分的解决办法_第1张图片

可以看到cell左边的部分没有到头,缺少一部分。

解决办法:

-(void)viewDidLayoutSubviews {

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

[self.myTabelView setSeparatorInset:UIEdgeInsetsZero];

}

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

[self.myTabelView setLayoutMargins:UIEdgeInsetsZero];

}

}

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

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

[cell setLayoutMargins:UIEdgeInsetsZero];

}

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

[cell setSeparatorInset:UIEdgeInsetsZero];

}

}

另外,隐藏cell的线的方法:

self.myTabelView.separatorStyle = NO;


文章出处:http://www.jianshu.com/p/e60961b912d5

你可能感兴趣的:(TableViewCell左边部分的线缺少一部分的解决办法)