How can i remove the table view cell highlighted color in edit mode. I am using the table view property “allowsMultipleSelection” in edit mode. By default the cell is highlighted in a light blue color. Although we can change the highlighted color i have not seen any option to remove that highlighted color property. I want my table view cell checkbox selection only and not highlighted mode.
"cell.SelectedBackgroundView" allows to change the cell's background color when its selected, but i want to have only checkbox selection and no color for the cell in selected state.
Attached image of the screen. In my case the cell has a background image so on selection also I want the cell background to be same and only the checkbox selected.
you can just change the backgroundView's backgroundColor property like so: cell. selectedBackgroundView?. backgroundColor = <your color .
If you want to disable selection for just some of the cells, use: cell. userInteractionEnabled = NO; As well as preventing selection, this also stops tableView:didSelectRowAtIndexPath: being called for the cells that have it set.
UITableViewCell
haveselectionStyle
property to highlight the cell on selection. These style highlight the cell with colour like:
Blue, Gray, Default(Light Gray), None
Upon selection of .none
style, it will only prevent from highlighting the cell. It will not block the selection. You can see that by applying breakpoint in didSelectRowAt indexPath:
function:
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
print("UITableView Selected")
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With