第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

隱藏一個UITableViewCell上的分隔線

隱藏一個UITableViewCell上的分隔線

德瑪西亞99 2019-10-23 16:34:32
我正在自定義UITableView。我想隱藏最后一個單元格上的分隔線...我可以這樣做嗎?我知道我可以做,tableView.separatorStyle = UITableViewCellStyle.None但是那會影響tableView的所有單元格。我希望它只影響我的最后一個單元格。
查看完整描述

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);

}


查看完整回答
反對 回復(fù) 2019-10-23
?
慕桂英4014372

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);

}


查看完整回答
反對 回復(fù) 2019-10-23
  • 3 回答
  • 0 關(guān)注
  • 1299 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號