2017-06-20 81 views
0

從下圖中,我想在選中時更改多個選擇按鈕的顏色和背景色(藍色部分)。如何更改UITableView的編輯風格?

的editingStyle定義下面

-(UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    return UITableViewCellEditingStyleDelete|UITableViewCellEditingStyleInsert; 
} 

我試圖設置的tableView的tintColor,而改變的多個選擇按鈕的顏色,但背景顏色不改變。

enter image description here

+0

你嘗試過什麼?你的代碼在哪裏? – Raptor

回答

1

您需要更改tintColormultipleSelectionBackgroundView每個細胞。

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 
    //... 

    cell.tintColor = UIColor.orange 

    let bgview = UIView() 
    bgview.backgroundColor = UIColor.purple 
    cell.multipleSelectionBackgroundView = bgview 

    //... 
} 

sample