简体   繁体   中英

UITableViewCell editing accessory color

I have a UITableView and have set multiple selection while editing to true

tableView.allowsMultipleSelectionDuringEditing = true

In the cell configuration (cellForRowAtIndexPath), I do:

            cell.selectionStyle = .default
            cell.accessoryType = .checkmark

So when tableView is set to editing mode, I get blue checkmark option on the left side. I want to change the default blue color on that accessory. How do I do that?

If you're using storyboard : Change the tint color here

在此处输入图片说明

In your custom UITableViewCell , set cell's tintColor in awakeFromNib() like so,

class CustomCell: UITableViewCell {
    override func awakeFromNib() {
        super.awakeFromNib()
        self.tintColor = .red
    }
}

Just set the cell tint color whatever you want. It will automatically change the accessory type color.

[cell setTintColor:[UIColor whiteColor]];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM