disable the uitableview highlighting but allow the selection of individual cells

前端 未结 12 1251
心在旅途
心在旅途 2020-12-07 18:29

when you tap on a cell the row gets selected and highlighted.Now what i want to do is disable the highlighting but allow the selection.Is there a way around it.There is ques

12条回答
  •  醉酒成梦
    2020-12-07 18:44

    Here is the solution for swift 3,works even in editing mode

    cell.selectionStyle = .gray
    cell.selectedBackgroundView = {
    
        let colorView = UIView()
        colorView.backgroundColor = UIColor.black.withAlphaComponent(0.0)
        //change the alpha value or color to match with you UI/UX
    
        return colorView
    }()
    

提交回复
热议问题