UIButton & UITextField blocks UITableViewCell deletion for deletion

UITableViewCell has UIButton and UITextField . Delete button enter image description here will not appear when scrolling over a UIButton or UITextField . I am looking for answers on SO and google, there are similar questions. Swipe left gestures over UITextField , but there are no correct answers.

I have a problem with iOS 8.

Edit After setting self.tableView.panGestureRecognizer.delaysTouchesBegan = YES; It works great for a cell with a UITextField . But when I drag the start with UIButton , the delete button appears and UIButton starts, which I do not want to fire UIButton .

+4
source share
1 answer

I don’t know how to prevent UIButton from firing, but the UITableViewCell has a showingDeleteConfirmation property that can be used to check if the Delete button is displayed. What am I doing, check this out in the UIButton action for TouchUpInside , e.g.

 - (void)buttonPressed:(id)sender { if (!self.showingDeleteConfirmation) { // Handle button press } } 

(This example is a subclass of UITableViewCell , so it uses self to access the property.)

This is in addition to

 tableView.panGestureRecognizer.delaysTouchesBegan = YES; 

which you already have, works to correctly recognize the napkins and the button action was not performed.

+1
source

Source: https://habr.com/ru/post/954646/


All Articles