【问题标题】:How to change the editing style of UITableView?如何改变 UITableView 的编辑风格?
【发布时间】:2017-06-20 03:51:20
【问题描述】:

从下图中,我想改变多选按钮的颜色和选中时的背景颜色(蓝色部分)。

editingStyle定义如下

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

我尝试设置tableView的tintColor,多选按钮的颜色改变了,但背景颜色没有改变。

【问题讨论】:

  • 你试过什么?你的代码在哪里?

标签: ios objective-c cocoa-touch


【解决方案1】:

您需要更改每个单元格的tintColormultipleSelectionBackgroundView

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

    cell.tintColor = UIColor.orange

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

    //...
}

【讨论】:

    猜你喜欢
    • 2012-08-11
    • 1970-01-01
    • 2012-12-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-07-29
    • 2017-10-30
    • 1970-01-01
    相关资源
    最近更新 更多