美文网首页
iOS 设置tableview分割线距左无空隙

iOS 设置tableview分割线距左无空隙

作者: 彗星来的那一夜 | 来源:发表于2016-11-22 13:51 被阅读59次

1.首先要设置分割线的属性,分割线边界和布局边界

 [tableView setSeparatorInset:UIEdgeInsetsZero];
 [tableView setLayoutMargins:UIEdgeInsetsZero];

2.然后再展示cell的代理方法中设置cell的边界

- (void)tableView:(UITableView *)tableView willDisplayCell:(nonnull UITableViewCell *)cell forRowAtIndexPath:(nonnull NSIndexPath *)indexPath
{
    [cell setSeparatorInset:UIEdgeInsetsZero];
    [cell setLayoutMargins:UIEdgeInsetsZero];
}

相关文章

网友评论

      本文标题:iOS 设置tableview分割线距左无空隙

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