3 回答
TA贡献1801条经验 获得超8个赞
在中viewDidLoad,添加以下行:
self.tableView.separatorColor = [UIColor clearColor];
并在cellForRowAtIndexPath:
适用于iOS较低版本
if(indexPath.row != self.newCarArray.count-1){
UIImageView *line = [[UIImageView alloc] initWithFrame:CGRectMake(0, 44, 320, 2)];
line.backgroundColor = [UIColor redColor];
[cell addSubview:line];
}
适用于iOS 7更高版本(包括iOS 8)
if (indexPath.row == self.newCarArray.count-1) {
cell.separatorInset = UIEdgeInsetsMake(0.f, cell.bounds.size.width, 0.f, 0.f);
}
TA贡献1871条经验 获得超13个赞
您可以使用以下代码:
斯威夫特:
if indexPath.row == {your row number} {
cell.separatorInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: .greatestFiniteMagnitude)
}
要么 :
cell.separatorInset = UIEdgeInsetsMake(0, 0, 0, UIScreen.main.bounds.width)
对于默认保证金:
cell.separatorInset = UIEdgeInsetsMake(0, tCell.layoutMargins.left, 0, 0)
端到端显示分隔符
cell.separatorInset = .zero
目标C:
if (indexPath.row == {your row number}) {
cell.separatorInset = UIEdgeInsetsMake(0.0f, 0.0f, 0.0f, CGFLOAT_MAX);
}
- 3 回答
- 0 关注
- 1242 浏览
添加回答
举报