cell的自定义背景,可以这样写
cell.selectedBackgroundView = UIView()
cell.selectedBackgroundView?.backgroundColor = UIColor.blackColor()
也可以在对应的cell里面重写高亮和选中的方法
//重写高亮
override func setHighlighted(highlighted: Bool, animated: Bool) {
// super.setHighlighted(highlighted, animated: animated)
if highlighted {
self.backgroundColor = UIColor(white: 0, alpha: 0.45)
}else {
self.backgroundColor = UIColor(white: 0, alpha: 0.25)
}
}
//重写选中
override func setSelected(selected: Bool, animated: Bool) {
// super.setSelected(selected, animated: animated)
if selected {
self.backgroundColor = UIColor(white: 0, alpha: 0.45)
}else {
self.backgroundColor = UIColor(white: 0, alpha: 0.25)
}
}
这里用的是swift,oc对应着改一下就可以了