- 首先在ViewDidLoad 或者ViewWillAppear里边写
1 if ([_tabView respondsToSelector:@selector(setSeparatorInset:)]) { 2 3 [_tabView setSeparatorInset:UIEdgeInsetsZero]; 4 5 } 6 if ([_tabView respondsToSelector:@selector(setLayoutMargins:)]) { 7 8 [_tabView setLayoutMargins:UIEdgeInsetsZero]; 9 10 }
- 然后在cellForRowIndexPath或者是Display里边加上
1 - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{ 2 3 4 if ([cell respondsToSelector:@selector(setSeparatorInset:)]) { 5 6 [cell setSeparatorInset:UIEdgeInsetsZero]; 7 8 } 9 10 if ([cell respondsToSelector:@selector(setLayoutMargins:)]) { 11 12 [cell setLayoutMargins:UIEdgeInsetsZero]; 13 } 14 15 16 17 18 }
之后 cell 下边的 线条就可以顶格了
![](https://img2024.cnblogs.com/blog/35695/202408/35695-20240813180353098-2140851696.jpg)