3 回答

TA貢獻1801條經(jīng)驗 獲得超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條經(jīng)驗 獲得超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)
對于默認(rèn)保證金:
cell.separatorInset = UIEdgeInsetsMake(0, tCell.layoutMargins.left, 0, 0)
端到端顯示分隔符
cell.separatorInset = .zero
目標(biāo)C:
if (indexPath.row == {your row number}) {
cell.separatorInset = UIEdgeInsetsMake(0.0f, 0.0f, 0.0f, CGFLOAT_MAX);
}
- 3 回答
- 0 關(guān)注
- 1299 瀏覽
添加回答
舉報