ios - UIView animation completion block execute immediately -
-(void)methodxxxx { [uiview animatewithduration:11 animations:^{ //...some animation changes... } completion:^(bool finished) { [_fallbtn removefromsuperview]; _fallbtn = nil; } }]; }
i call method @ -viewdidappear
, while directly call completion block.
why? there strange things ive missed?
i found 1 more wired thing:
cakeyframeanimation *pathanimation = [cakeyframeanimation animationwithkeypath:@"position"]; pathanimation.calculationmode = kcaanimationpaced; pathanimation.fillmode = kcafillmodeforwards; pathanimation.removedoncompletion = yes; //if set yes, directly call -animationdidstop method; if no, animation execute while never call -animationdidstop pathanimation.duration = 10; pathanimation.delegate = self; //here implement -animationdidstop method
use below code.
-(void)viewdidappear:(bool)animated { [self performselector:@selector(methodxxxx) withobject:nil afterdelay:0.1f]; } -(void)methodxxxx { [uiview animatewithduration:11 animations:^ //...some animation changes... } completion:^(bool finished) { [_fallbtn removefromsuperview]; _fallbtn = nil; }]; }
Comments
Post a Comment