美文网首页
tableView下划线全屏幕宽度

tableView下划线全屏幕宽度

作者: Ice丶泽 | 来源:发表于2016-11-02 11:53 被阅读0次

该方法,使tableView系统自带的那条线补全屏幕,不会存在前端的空白

if ([self.tableView respondsToSelector:@selector(setSeparatorInset:)]) {
[self.tableView setSeparatorInset:UIEdgeInsetsZero];
}
if ([self.tableView respondsToSelector:@selector(setLayoutMargins:)]) {
[self.tableView setLayoutMargins:UIEdgeInsetsZero];
}
}
- (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];
}
}

或者

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

相关文章

网友评论

      本文标题:tableView下划线全屏幕宽度

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