Lescai Ionel
Lescai Ionel

Reputation: 4373

How to handle multi-touch in UITableViewCell with buttons?

I have custom table view cells that each have 3 buttons. Selecting a row in the table pushes another view controller; pressing one of the buttons shows a modal view.

If, with two fingers, I select a row, and press a button, both the controller gets pushed and the modal view appears . I've tried setting a flag in the buttons' TouchDown event and returning nil in tableView: willSelectRowAtIndexPath: if the flag is true, but the flags gets set to false in the buttons' TouchUpInside event handler, so the tableview: didSelectRowAtIndexPath: still gets called.

How can I solve this issue ?

Upvotes: 0

Views: 732

Answers (2)

JoeZhang
JoeZhang

Reputation: 1

It helps

cell.contentView.exclusiveTouch = YES;
cell.exclusiveTouch = YES;

setting exclusiveTouch to custom UITableViewCell

Upvotes: 0

Steve Wilford
Steve Wilford

Reputation: 9012

In your button's touch down method, set the UITableView's allowsSelection property to NO. Then in the touch up (both inside and outside) handler set it back to YES.

Upvotes: 2

Related Questions