I have a UITableView inside my VC, and basically what I want is the first section of it be non-tappable. But I cannot use isUserInteractionEnabled
because I have UISwitch inside of each row of this section. Setting selectionStyle
to .none
changes nothing. I can only pick No Selection
in the interface inspector to disable those rows, but it disables the entire table. What should I do?
EDIT
Here's my custom cell class
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
}
}
}