disable the uitableview highlighting but allow the selection of individual cells

当你点击一个单元格的行被选中并突出显示。现在我想要做的是禁用突出显示,但允许选择。是否有解决方法。有问题可以解答,但它会禁用选择和突出显示。


You can just set the cell's selection style to "None" from Storyboard:

看这里

Or from code:

cell.selectionStyle = UITableViewCellSelectionStyleNone;

For Swift 3:

cell.selectionStyle = UITableViewCellSelectionStyle.none

For Swift 4 & above:

cell.selectionStyle = .none

Change UITableViewCell 's selectedBackgroundView color to transparent.

    let clearView = UIView()
    clearView.backgroundColor = UIColor.clearColor() // Whatever color you like
    UITableViewCell.appearance().selectedBackgroundView = clearView

or to set for a specific cell:

cell.backgroundView = clearView


Try setting cell selection style to None -

[cell setSelectionStyle:UITableViewCellSelectionStyleNone];

This will solve your problem

链接地址: http://www.djcxy.com/p/49404.html

上一篇: 参数化的jUnit测试,无需更改跑步者

下一篇: 禁用uitableview突出显示,但允许选择单个单元格