nullforlife nullforlife - 1 year ago 187
iOS Question

Disable 3D touch for UIButton in UITableViewCell

I have a

with customized
. In the cells I have a
which I don't want to be trigged by the 3D touch event for the cell.

I want it to work in a similar manner as in Apples messages app, if you take a look there it works in the way that if you press the thumbnail for the message sender image (or initials) you get a different peek & pop from when you press the whole cell. Only difference is that I want to completely ignore the peek & pop for my button. Anyone out there that knows a good solution to this?

Thank you in advance.

Answer Source

I solved this by adding a UIButton that covered the whole UITableViewCell and then for the UIButton I did not want to be triggered I created a separate UIView with clear background that I laid on top of the 3D touch triggered UIButton.

This creates a 3D touch animation for the whole UITableViewCell which looks awesomely beautiful.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download