0
分配给“accessoryType”,我希望它进行检查。我也想要其他任何被检查的单元没有附件。不幸的是,我收到错误信息,说我无法更改accessoryType。那是因为我使用visibleCells()
来获取细胞吗?我如何克服这个错误?不能在UITableViewCell中
我曾尝试不使用常量;我得到了同样的错误。我看了UITableView & UITableViewCell类的引用,但我没有看到任何可以帮助我的东西。我的备份计划是使用Picker View,但我更喜欢使用Table View,因为它的设计。
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
let cell = tableView.cellForRowAtIndexPath(indexPath)
let cells = tableView.visibleCells()
for oldCell in cells {
if(oldCell.accessoryType == UITableViewCellAccessoryType.Checkmark) {
oldCell.accessoryType = .None //Cannot assign to 'accessoryType' in 'oldCell'
}
}
cell!.accessoryType = .Checkmark
day = cell!.textLabel!.text!
self.tableView.deselectRowAtIndexPath(indexPath, animated: true)
}