【发布时间】:2017-11-06 22:09:05
【问题描述】:
我希望有人可以帮助您解决这个编码问题。我想用导航栏按钮更改我的集合视图单元格背景颜色,这是我的栏按钮选择器代码:
func handleBrightnessChanged() {
let readingCell = ReadingsDisplayCell()
readingCell.backgroundColor = .red
}
但是,当我单击该按钮时,它没有任何作用。你能帮我么?下面是我的 UICollectionViewCell 类:
class ReadingsDisplayCell: UICollectionViewCell {
override init(frame: CGRect) {
super.init(frame: frame)
backgroundColor = UIColor.gray
}
required init?(coder aDecoder: NSCoder) {
fatalError("fatal error in Daily cell")
}
}
非常感谢。
【问题讨论】:
-
在运行时,collectionView 单元格的背景颜色是灰色的吗?
标签: ios swift uicollectionview