disable the uitableview highlighting but allow the selection of individual cells

前端 未结 12 1238
心在旅途
心在旅途 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:55

    Change UITableViewCell's selectedBackgroundView color to transparent.

        let clearView = UIView()
        clearView.backgroundColor = UIColor.clearColor() // Whatever color you like
        UITableViewCell.appearance().selectedBackgroundView = clearView
    

    or to set for a specific cell:

    cell.backgroundView = clearView

提交回复
热议问题