[UIView animatewithduration:<# (Nstimeinterval) #> delay:<# (nstimeinterval) #> options:<# ( uiviewanimationoptions) #> animations:<#^ (void) animations#> completion:<#^ (BOOL finished) completion# >
This function first requires that the animations animation settings be performed immediately by the function call, while the delay time is performed completion. Here's a pit where if you want to click on a control that is performing a uiview animation, for example, to change the position of X, Y, even if we search the Web for a configuredUIViewAnimationOptionAllowUserInteraction也是不行触发点击,原因就是控件首先执行了animations动画,x,y轴已经改变。
Workaround one: Overwrite an animation, set to Alpha 0.99, and trigger your event by this control
Solution Two (recommended): Use real delay dispatch_after
1 dispatch_after (Poptime, Dispatch_get_main_queue (), ^ (void) {2 [UIView animatewithduration:0.5 animations:^{3 // moving animation 4 } completion:^(BOOL finished) {5 // animation completed settings 6 }]; 7 });
Animatewithduration of the iOS pit