iphone - 如何使 UITableView 上的单元格不可选?

标签 iphone objective-c cocoa-touch uitableview

我有一个要插入到 UITableView 顶部的单元格。如何确保当用户单击单元格时,它不会显示蓝色选定指示器?

最佳答案

要取消根据行索引选择任何表格单元格或特定表格单元格的功能,请使用 willSelectRowAt

func tableView(_ tableView: UITableView, willSelectRowAt indexPath: IndexPath) -> IndexPath? {


        return nil
    }

要简单地移除选择元素的 UI 效果,设置 selection style of the UITableViewCellUITableViewCellSelectionStyleNone

swift 5:

selectionStyle = .none

关于iphone - 如何使 UITableView 上的单元格不可选?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2641530/

相关文章:

iphone - 基于 quartz 的阴影在 UITextView 上对我不起作用

ios - XCTests 在物理设备上失败 : "Canceling tests due to timeout ..."

iphone - 为什么我的 View 类没有出现在故事​​板中?

ios - 在场景中为 SKLabel 设置动画?

objective-c - 如何使用 Objective-C 解析 JSON?

iphone - 找不到 plist 文件

iphone - 自动释放池与垃圾回收有什么联系?

objective-c - NSTimer 在 OS X(OS X 10.9) 上不正确

cocoa-touch - iPad应用程序崩溃导致重启内存问题?

ios - 如何在英文环境下比较中文字符串?