简体   繁体   中英

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

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.

在此输入图像描述

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

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.

为了更好地理解,只需看下面的图像,放置自定义检查按钮,并根据点击更改图像

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.

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!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM