我在 Swift 3 中工作,并试图让表格 View 单元格突出显示绿色并在点击时显示复选标记。
目前,当我运行应用程序时,我可以选择一个单元格,它会变成浅灰色,一旦我选择另一个,它就会变成绿色,但仍然无法显示复选标记。
代码如下:
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let mySelectedCell = tableView.cellForRow(at: indexPath)
mySelectedCell?.accessoryType = UITableViewCellAccessoryType.checkmark
mySelectedCell?.tintColor = UIColor.white
mySelectedCell?.backgroundColor = green
}
如有任何建议,我们将不胜感激。
最佳答案
尝试:
self.tableView.reloadRowsAtIndexPaths([indexPath], withRowAnimation: .None);
关于ios - 为什么我的 UITableView 的选定单元格不显示复选标记附件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39086411/