第一种(不自己划线)
第一步
//1.解决tableView分割线不顶头
if ([self.table respondsToSelector:@selector(setSeparatorInset:)])[self.table setSeparatorInset:UIEdgeInsetsZero];
if ([self.table respondsToSelector:@selector(setLayoutMargins:)]) [self.table setLayoutMargins:UIEdgeInsetsZero];
第二步
//2.解决tableView分割线不顶头
- (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在cell中自己画线
先写一下这句话 把tableView 的自带分割线删除
self.table.separatorStyle = UITableViewCellSeparatorStyleNone;
然后在自定义cell里面
写一个view 在最底部 当做分割线 就好了。