Making UI interfaces, implementing program functions is a priority, but using animations to enhance the experience, people should not reject it.
So what's the problem?
One: Steady:
Step by step, after all, impatient to eat hot tofu.
1. Turn on an animation
2, set various properties of the animation: animation duration, time delay, auto-return, animation repetition, transition animation ...
3, sets the end state of the animated UI when it is, the final position of the UI, and so on.
4, commit the animation.
Done. Specific details are as follows:
//= = =---start animation---= = =[UIView Beginanimations:nil Context:nil]; //--duration of animation---[UIView setanimationduration:2]; //==--Animation Delay[UIView Setanimationdelay:1]; //= = Set auto return animation = = =[UIView Setanimationrepeatautoreverses:yes]; //= =---Set the number of animation repetitions---= =[UIView Setanimationrepeatcount:2.5]; //==--setting up a proxy for animations 1--==[UIView setanimationdelegate:self];//= = =---Set the action when the animation is complete 2---= = =[UIView setanimationdidstopselector: @selector (ChangeColor)]; //Set Transition animations[UIView setanimationtransition:uiviewanimationtransitionflipfromright forview:_view Cache:yes];//= = =---The effect of the animation to be completed---= =_view.center=Self.view.center; _view.bounds=cgrectmake (0,0, -, -); _view.alpha=0.5; //= = =---commit animation---= = =[UIView commitanimations]; */
2, Shortcut:
If you feel that the above steps are too cumbersome, then you can only use that trick.
The "block" mode of animation, using UIView call class method, according to the actual needs, choose a different method. In particular, multiple animation processes can be executed consecutively (the next animation at the end of an animation).
//======------Block way to achieve UIView animation------======[UIView animatewithduration:2animations:^{//two-second animation _view.center=Self.view.center; }completion:^(BOOL finished) {//At the end of the next animation [UIView animatewithduration:2animations:^{_view.bounds=cgrectmake (0,0, -, -); }completion:^(BOOL finished) {//At the end of the next animation, nested layers, and so on. [UIView animatewithduration:2animations:^{_view.alpha=0.5; }completion:^(BOOL finished) {[UIView animatewithduration:1animations:^{_view.backgroundcolor=[Uicolor Greencolor]; }]; }]; }]; }];}
To the poor Trinidad, to the further heights!
UIView animation effects