Reputation: 7227
There are UIButton
and UITextField
in the UITableViewCell
. The delete button will not come up when I swipe over UIButton
or UITextField
. I do search for the answers on SO and google, there is a similar questions Swipe left gestures over UITextField, but no correct answers.
I got this problem on iOS 8.
Edit
After setting self.tableView.panGestureRecognizer.delaysTouchesBegan = YES;
, it works perfect for cell with UITextField
. But when i drag start from the UIButton
, the delete button shows and the UIButton
fired, which I do not want the UIButton
get fired.
Upvotes: 4
Views: 682
Reputation: 8387
I don't know how to prevent the UIButton
from firing in the first place, but UITableViewCell
has the property showingDeleteConfirmation
that can be used to check whether the Delete button is being shown. What I do is check this in the UIButton
action for TouchUpInside
, like this
- (void)buttonPressed:(id)sender
{
if (!self.showingDeleteConfirmation) {
// Handle button press
}
}
(This example is from a UITableViewCell
subclass, so it uses self
to access the property.)
This, in addition to the
tableView.panGestureRecognizer.delaysTouchesBegan = YES;
that you already have, works to get the swipe properly recognized and the button action not performed.
Upvotes: 1