【发布时间】:2017-05-31 14:51:42
【问题描述】:
我在 UICollectionView 原型单元格中添加了一个按钮,我想更新单元格标签中显示的属性:
非常感谢
编辑: 可能需要创建一个同样获取 indexPath.row 但不知道如何操作的函数。
override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
//let cell = collectionView.dequeueReusableCell(withReuseIdentifier: reuseIdentifier, for: indexPath)
//var cell :CounterCollectionViewCell!
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "cell", for: indexPath) as! CounterCollectionViewCell
// Configure the cell
let myColor :UIColor = UIColor(red: 240/255, green: 179/255, blue: 28/255, alpha: 1.0)
let presentCounter = counters[indexPath.row]
cell.nameLabel.text = presentCounter.nameCD
cell.valueLabel.text = String(presentCounter.valueCD)
cell.backgroundColor = myColor
cell.layer.cornerRadius=10
return cell
}
@IBAction func masterCellAction() {
}
【问题讨论】:
标签: swift button uicollectionview swift3 uicollectionviewcell