我在 View 中使用了 Collection View 和一个表格 View ,并且在 didSelect 函数上图像没有改变。
下面是代码:
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let cell:list2TableCell = list2Table.dequeueReusableCell(withIdentifier: "Cell") as! list2TableCell
let image = UIImage(named: "fill-square")
cell.tickImage.image = image
}
最佳答案
尝试:
if let cell:list2TableCell = list2Table.cellForRow(at: indexPath) as? list2TableCell{
let image = UIImage(named: "fill-square")
cell.tickImage.image = image
}
关于ios - didSelectRowAt 上的图像没有变化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52544014/