How to change color of UITableViewCell when selecting?

前端 未结 14 2533
予麋鹿
予麋鹿 2020-12-04 10:59

I have a menu like so:

\"Menu\"

The normal (unselected) state for each cell is an image, the selected s

14条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-04 11:39

    Based on Milan Cermak's answer, you can use UIAppearance.

    In Swift 1.1 / 2.0:

    let selectionView = UIView()
    selectionView.backgroundColor = UIColor.redColor()
    UITableViewCell.appearance().selectedBackgroundView = selectionView
    

提交回复
热议问题