In iOS development, some common simple animations can be animated with uivew to achieve
Learn about UIVIew some popular animations today
1.
Flipped animation [UIView beginanimations:@ "Doflip" context:nil]; settings are often [UIView setanimationduration:1]; Set animation fade [UIView setanimationcurve:uiviewanimationcurveeaseinout]; Set Agent [UIView setanimationdelegate:self]; Set rollover Direction [UIView setanimationtransition: uiviewanimationtransitionflipfromleft Forview: Self.redview Cache:yes]; End of animation [UIView commitanimations];
Effect:
2. Displacement animation
[UIView beginanimations:@ "move" Context:nil]; [UIView setanimationduration: 2 ]; [UIView setanimationdelegate:self]; // Change the value of x, y of its frame Self.redview.frame=cgrectmake (+); [UIView commitanimations];
Effect:
Another way to do this:
[UIView animatewithduration:0.5 delay:0.1 usingspringwithdamping:0.5 initialspringvelocity:5.0 options: Uiviewanimationoptioncurveeaseinout animations:^{ Cgpoint point = _redview.center; Point.y + =; [_redview setcenter:point]; } completion:^ (BOOL finished) { }];
Effect:
3. Keyframe Animation
void (^keyframeblock) () = ^ () {//Create color array nsarray *arraycolors = @[[uicolor Orangecolor], [Uicolor Yellowcolor], [Uicolor Greencolor], [Uicolor Bluecolor], [Uicolor Purplecolor], [Uicolor REDC Olor]]; Nsuinteger Colorcount = [arraycolors count]; Loop add Keyframe for (Nsuinteger i = 0; i < Colorcount; i++) {[UIView addkeyframewithrelativestarttime:i/ (cgfloat) Colorcount relativeduration:1/(cgfloat) Colorcount animations:^{[_redview Setbackgroundcolor:arraycolors[i]]; }]; } }; [UIView animatekeyframeswithduration:5.0 delay:0.0 Optio Ns:uiviewkeyframeAnimationoptioncalculationmodecubic | Uiviewanimationoptioncurvelinear Animations:keyframeblock Comple tion:^ (BOOL finished) {//After the animation is completed//code ... }];
Effect:
iOS animation Learning (-) UIView self-animating