Is there a way that I can disable a UITableViewCell from triggering the didSelectCellAtIndexPath:
delegate, while still retaining the ability to use a UISwitch that is in the accessory view of that cell.
I know you can set cell.userInteractionEnabled = NO, this will disable the cell but is also prevents me from using the switch in the accessory view. I know I could also try to detect what cell was tapped in the didSelectCellAtIndexPath:
method but since my table view is dynamic and changes depending on what the user is doing that could get messy.
I'm looking for a simple and elegant solution that I could use. Any ideas?
if you do not wan't to use cell.userInteractionEnabled = NO then you set cell.selectionStyle = UITableViewCellSelectionStyleNone
and let your cell trigger didSelectRowAtIndexPath.
Now here in this method "didSelectRowAtIndexPath" you have to avoid / ignore selection , by comparing object type from your datasource array at that particular index.
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