UITableViewCell Selected Background Color on Multiple Selection

后端 未结 14 966
夕颜
夕颜 2020-12-08 04:26
// Doesn\'t work
cell.selectionStyle = .Blue
//Works when the selection is not multiple, if it\'s multiple with each selection the previous one disappear...
let cell         


        
14条回答
  •  时光说笑
    2020-12-08 04:48

    For Swift 3,4 and 5 you can do this in two ways.

    1) class: UITableViewCell

    override func awakeFromNib() {
        super.awakeFromNib()
        //Costumize cell
    
        selectionStyle = .none
    }
    

    or

    2) tableView cellForRowAt

        cell.selectionStyle = .none
    

    If you want to set selection color for specific cell, check this answer: https://stackoverflow.com/a/56166325/7987502

提交回复
热议问题