方法一:
// 去掉系统分割线
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
// 换成自己的分割线
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
UIView *line = [[UIView alloc] initWithFrame:CGRectMake(15, 0, Screen_width - 15, 0.5)];
line.backgroundColor = YHYCellSeparatorLineColor;
[cell addSubview:line];
}
方法二:
// 直接修改系统分割线位置
if ([tableV respondsToSelector:@selector(setSeparatorInset:)]) {
[tableV setSeparatorInset:UIEdgeInsetsMake(0, 0, 0, 0)];
}