KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
It appears to me these two class methods are not interchangeable. I have a subview of UIView with the following code in the touchesBegan method: if (!highlightView) { UIImageView *tempImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Highlight"]]; self.highlightView = tempImageView; [tempImageView release]; [self addSubview:highlightView]; } highlightView.alpha = 0.0; [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:0.5]; highlightView.alpha = 1.0; [UIView commitAnimations]; When I touch the Button, the highlight fades in, like you would expect. When I touch up immediately (before the animation is finished), my touchesEnded gets called. This is the behavior I want. But now, I've become a big fan of blocks and try to use them wherever possible. So I replaced the UIView animation code with this: [UIView animateWithDuration:0.2 animations:^{ highlightView.alpha = 1.0; }]; Results: the highlight still fades in as expected, but if I touch up before the animation is finished, my touchesEnded does not get called. If I touch up after the animation is finished, my touchesEnded does get called. What's going on here?
Tags (comma-separated)
Save Edits
Cancel