uiviewanimation

UIButton can't be touched while animated with UIView animateWithDuration

孤街醉人 提交于 2019-11-26 01:07:50
问题 I have the following code: [UIView animateWithDuration:0.3 delay:0.0 options:UIViewAnimationCurveEaseOut | UIViewAnimationOptionAllowUserInteraction animations:^{ CGRect r = [btn frame]; r.origin.y -= 40; [btn setFrame: r]; } completion:^(BOOL done){ if(done){ [UIView animateWithDuration:0.3 delay:1 options:UIViewAnimationOptionCurveEaseIn | UIViewAnimationOptionAllowUserInteraction animations:^{ CGRect r = [btn frame]; r.origin.y += 40; [btn setFrame: r]; } completion:^(BOOL done){if(done)

Cancel a UIView animation?

℡╲_俬逩灬. 提交于 2019-11-26 00:49:56
问题 Is it possible to cancel a UIView animation while it is in progress? Or would I have to drop to the CA level? i.e. I\'ve done something like this (maybe setting an end animation action too): [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:duration]; [UIView setAnimationCurve: UIViewAnimationCurveLinear]; // other animation properties // set view properties [UIView commitAnimations]; But before the animation completes and I get the animation ended event, I want to