Is possible disable click on accessory View's part of custom UITableViewCell?

229 views Asked by At

I have a custom UITableViewCell in my UITableView of an objective c application. I had a imageView on the left and a label, but now I want add a check in the right position. I have this check added in accessory view into my custom cell, but I have the didSelectRow function too.

enter image description here

How can I disable the didSelectRow in the region of accesoryView? Is it possible?

3

There are 3 answers

0
Tim Bernikovich On

You can add UIButton on right side with size you want. In your cell create delegate protocol, VC should implement it and set self as delegate.

0
Pankaj K. On

You can also make Custom button for your check button. set button click and delegate if you need to perform anything out of your cell class. so when you tap on button you will get button click on that region and if you click on outer space of button you will get did select of tableview.

for better understanding just see bellow image, place your custom check button and change image based on click

0
AmitaiB On

Though the OP probably has their answer long since, for posterity: this UITableViewDelegate method: tableView(_:accessoryButtonTappedForRowWith:) exists to resolve this issue/mmet this need.

Cheers!