从下图中,我想更改多选按钮的颜色和选中时的背景颜色(蓝色部分)。
editingStyle定义如下
-(UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath
{
return UITableViewCellEditingStyleDelete|UITableViewCellEditingStyleInsert;
}
我尝试设置tableView的tintColor,多选按钮的颜色变了,但是背景色没有变。
最佳答案
您需要更改每个单元格的 tintColor
和 multipleSelectionBackgroundView
。
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
//...
cell.tintColor = UIColor.orange
let bgview = UIView()
bgview.backgroundColor = UIColor.purple
cell.multipleSelectionBackgroundView = bgview
//...
}
关于ios - 如何改变UITableView的编辑风格?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44643522/