ios - 如何禁用 UITableViewCell 突出显示?

标签 ios uitableview swift2

我有一个深灰色的 View 背景和一个透明的表格 View 。我正在使用以下代码尝试在单击单元格时停止单元格突出显示。它在最初单击单元格时除外,我看到一个突出显示。然后我过渡到另一个场景。当我回来时,单元格没有突出显示。

func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
    var selectedCell:UITableViewCell = tableView.cellForRowAtIndexPath(indexPath)!
    selectedCell.contentView.backgroundColor = UIColor.clearColor()
    tableView.deselectRowAtIndexPath(indexPath, animated: true)
}

如何禁用仍在进行的初始单元格突出显示?

最佳答案

设置UITableViewCell选择样式为无

cell.selectionStyle = .None

关于ios - 如何禁用 UITableViewCell 突出显示?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38488556/

相关文章:

ios - iOS 的 kAudioDevicePropertyBufferFrameSize 替换

iOS v10 或更低版本 : How to add UISearchController in the bottom of navigation bar Programmatically

iphone - tableView 作为半透明 View 中的 subview

swift - 如何为 NSButton 的标题设置自定义颜色和字体大小?(在 OS X NOT iOS 中)

ios - 如何在swift中传递C指针

iphone - 子类化 UIButton 添加一个属性

iphone - 设置委托(delegate)、数据源和文件所有者连接后,uitableView reloadData 不起作用

ios - UITableView - IndexPath 始终首先返回 0 并点击 2 次以将正确的数据传递给 View Controller

ios - ViewController 方向变化不是动画的

ios - 我想在应用程序每 10 次快速打开时显示一条警报