【发布时间】:2017-07-06 05:04:50
【问题描述】:
我的 VC 中有一个 UITableView,基本上我想要的是它的第一部分是不可点击的。但我不能使用isUserInteractionEnabled
因为我在本节的每一行中都有 UISwitch 。将selectionStyle 设置为.none 没有任何改变。我只能在界面检查器中选择No Selection 来禁用这些行,但它会禁用整个表。我该怎么办?
编辑
这是我的自定义单元格类
class CustomCell: UITableViewCell {
override func setHighlighted(_ highlighted: Bool, animated: Bool) {
if highlighted {
self.backgroundColor = ColorConstants.onTapColor
} else {
self.backgroundColor = .clear
}
}
override func setSelected(_ selected: Bool, animated: Bool) {
if selected {
self.backgroundColor = ColorConstants.onTapColor
} else {
self.backgroundColor = .clear
}
}
}
【问题讨论】:
标签: ios swift xcode uitableview