For use this code import QuartzCore framework like bellow
#import <QuartzCore/QuartzCore.h>   
and then use bellow code
   CABasicAnimation *theAnimation;
    theAnimation=[CABasicAnimation animationWithKeyPath:@"transform.rotation"];
    theAnimation.duration=1.0; // Animation duration
    theAnimation.repeatCount=1; // no of times you want to do animation
    theAnimation.autoreverses=YES; // reverses the animation
    theAnimation.fromValue=[NSNumber numberWithFloat:0.0]; // initial stage of animation
    theAnimation.toValue=[NSNumber numberWithFloat:3.0]; // rotation angle
    [yourImageView.layer addAnimation:theAnimation forKey:@"animateRotation"]; // add animation to thelayer of a view for which you want animation.
 
No comments:
Post a Comment