我需要通过单击同一单元格中的按钮来更新标签。为什么我的代码不起作用?
@IBAction func actionFaveUnfave(sender: AnyObject) {
let cell = self.tableView.cellForRowAtIndexPath(sender.indexPath)
println(cell?.labelFavedTimes)
cell.labelFavedTimes = "22"}
最佳答案
cell?.labelFavedTimes.text = "22"
顺便说一句
self.tableView.cellForRowAtIndexPath(sender.indexPath)
如果单元格不可见,可以返回 nil
关于swift - 更新自定义 UITableView 单元格中的标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31562400/