// 清空分割线的边距
- (void)viewDidLoad {
self.tableView.separatorInset = UIEdgeInsetsZero;
self.tableView.layoutMargins = UIEdgeInsetsZero;
}
// cell将要显示的时候会调用此方法
-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
cell.layoutMargins = UIEdgeInsetsZero;
cell.separatorInset = UIEdgeInsetsZero;
}
- (void)viewDidLoad {
// 隐藏自带的分割线
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
}
// 自己加一个分割线
UIView *line = [[UIView alloc]init];
line.backgroundColor = [UIColor lightGrayColor];
[self addSubview:line];
[line mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.mas_left).offset();
make.right.equalTo(self.mas_right).offset();
make.bottom.equalTo(self.mas_bottom).offset();
make.height.offset( / [UIScreen mainScreen].scale);
}];