美文网首页
TableViewCell左边部分的线缺少一部分的解决办法

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

作者: 龍之逆鳞 | 来源:发表于2017-09-20 14:10 被阅读8次


可以看到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左边部分的线缺少一部分的解决办法

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