UITableView Swipe Delete: sometimes a delete button appears

In my application, I was trying to implement a delete function to delete the function for the TableView.I ran the following codes.

- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:    (NSIndexPath *)indexPath
{
    return YES;
}

- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath;
{
    return UITableViewCellEditingStyleDelete;
}

-(void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (editingStyle == UITableViewCellEditingStyleDelete)
    {
      //code to delete
    }
}

      

UIGestureRecognizerDelegate

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer 
{
     return YES;
}

      

But the problem is that the commitEditingStyle method is only called at about 1/20. What could be the problem? Thank. Help with help.

+3
ios objective-c uitableview edit


source to share


No one has answered this question yet

Check out similar questions:

1473
Using Auto Layout in UITableView for Dynamic Cell Layouts and Variable Row Heights
1172
How can I disable the selection of a UITableView?
512
UITableViewCell, show delete button on scroll
4
ReloadRowsAtIndexPaths without string animation animation
3
RegEx. + Does not include space and new string characters.
1
Can't delete rows in table with command Three20
0
Refresh or reload UITableView after delete action completes in detail view
0
tableView: commitEditingStyle received a call for a row that should not be deleted
0
Duplication in Uitableview cell?
0
UITableView - how to recognize deletion canceled?



All Articles
Loading...
X
Show
Funny
Dev
Pics