我有一个要插入到 UITableView 顶部的单元格。如何确保当用户单击单元格时,它不会显示蓝色选定指示器?
最佳答案
要取消根据行索引选择任何表格单元格或特定表格单元格的功能,请使用 willSelectRowAt
func tableView(_ tableView: UITableView, willSelectRowAt indexPath: IndexPath) -> IndexPath? {
return nil
}
要简单地移除选择元素的 UI 效果,设置 selection style of the UITableViewCell到 UITableViewCellSelectionStyleNone
swift 5:
selectionStyle = .none
关于iphone - 如何使 UITableView 上的单元格不可选?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2641530/