NSInteger angle = 0;
-(void)startAnimation1
{
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.05];
[UIView setAnimationDelegate:self];
[UIView setAnimationBeginsFromCurrentState:YES];
[UIView setAnimationWillStartSelector:@selector(startAnimationStart)];
[UIView setAnimationDidStopSelector:@selector(startAnimation1)];
angle += 5;
AnminationImageD.transform = CGAffineTransformMakeRotation(angle * (M_PI / 180.0f));
[UIView commitAnimations];
}
-(void)startAnimation2
{
CGAffineTransform endAngle = CGAffineTransformMakeRotation(angle * (M_PI / 180.0f));
[UIView animateWithDuration:0.01 delay:0 options:UIViewAnimationOptionCurveLinear animations:^{
AnminationImageD.transform = endAngle;
} completion:^(BOOL finished) {
angle += 10;
[self startAnimation2];
}];
}
-(void)startAnimation3{
CABasicAnimation* rotationAnimation;
rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
rotationAnimation.toValue = [NSNumber numberWithFloat: M_PI * 2.0 ];
rotationAnimation.duration = 5.0;
rotationAnimation.cumulative = YES;
rotationAnimation.repeatCount = 1000;
[AnminationImageD.layer addAnimation:rotationAnimation forKey:@"rotationAnimation"];
}