美文网首页
cell线从头开始画

cell线从头开始画

作者: 天亮説晚安 | 来源:发表于2016-01-27 11:46 被阅读41次

1、在viewDidLoad中添加:

if ([_tableView respondsToSelector:@selector(setSeparatorInset:)]) 
{
    [_tableView setSeparatorInset:UIEdgeInsetsZero];
}

if ([_tableView respondsToSelector:@selector(setLayoutMargins:)]) 
{
    [_tableView setLayoutMargins:UIEdgeInsetsZero];
}

2、重写下面的方法

- (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];
   }
}

相关文章

网友评论

      本文标题:cell线从头开始画

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