我通过隐藏全部分割线,手动画线已经解决了该BUG,只是不知道这个BUG为何会产生,特地来请教.
这是我的tableView
- (UITableView *)tableView {
if (!_tableView) {
_tableView = [[UITableView alloc]initWithFrame:self.view.bounds style:UITableViewStylePlain]; // 把tableView Style设置为UITableViewStyleGrouped,就不会有section停留效果
_tableView.backgroundColor = HEXCOLOR(0xf5f5f5);
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone; // 隐藏系统分割线
_tableView.tableFooterView = [[UIView alloc] init]; // 没数据的时候不显示分割线
_tableView.rowHeight = CMHeightPixel * 100;
_tableView.delegate = self;
_tableView.dataSource = self;
}
[self.view addSubview:_tableView];
}
return _tableView;
}
创建cell的代理方法里面的代码:
if (indexPath.row == 2) { // 指定去除row2的分割线
cell.separatorInset = UIEdgeInsetsMake(0, 0, 0, kScreenWidth);
}
rowHeight 高度不精确导致的,使用 floor 或者 ceil函数可以解决这个问题