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