Reputation: 9722
I've attached a tap gesture to a view, at first it seemed to work, but after animation the view the gesture is complete ignored until the view is back at it's original position.
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tap:)];
[self.cellView addGestureRecognizer:tap];
[tap release];
In here I animate the view to the right
[UIView animateWithDuration:0.3
delay:0.0
options:UIViewAnimationOptionAllowUserInteraction
animations:^
{
[cellView setFrame:CGRectMake(cellViewX, cellView.frame.origin.y, cellView.frame.size.width, cellView.frame.size.height)];
[editView setFrame:CGRectMake(editViewX, editView.frame.origin.y, cellView.frame.size.width, cellView.frame.size.height)];
}
completion:^(BOOL finished)
{
NSLog(@"Animation complete");
}];
The completion handler is triggered, but now the tap gesture is completely being ignored.
Upvotes: 2
Views: 278
Reputation: 9722
Ok, turns out I just made a stupid copy/paste error, I accidentally used the wrong values when setting the frame for the animations
[cellView setFrame:CGRectMake(cellViewX, cellView.frame.origin.y, cellView.frame.size.width, cellView.frame.size.height)];
[editView setFrame:CGRectMake(editViewX, cellView.frame.origin.y, cellView.frame.size.width, cellView.frame.size.height)];
Had to be
[cellView setFrame:CGRectMake(cellViewX, cellView.frame.origin.y, cellView.frame.size.width, cellView.frame.size.height)];
[editView setFrame:CGRectMake(editViewX, editView.frame.origin.y, editView.frame.size.width, editView.frame.size.height)];
So yes, when you copy/past code around midnight, make sure to double check it in the morning! :)
Upvotes: 1