I have a UIImageView in my UIViewController. I set the image on it. I made a turn as shown below.
- (void) runSpinAnimationOnView:(UIImageView*)view duration:(CGFloat)duration rotations:(CGFloat)rotations repeat:(float)repeat
{
CABasicAnimation* rotationAnimation;
rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
rotationAnimation.toValue = [NSNumber numberWithFloat: M_PI * 2.0 * rotations * duration ];
rotationAnimation.duration = duration;
rotationAnimation.cumulative = YES;
rotationAnimation.repeatCount = repeat;
[view.layer addAnimation:rotationAnimation forKey:@"rotationAnimation"];
}
I call it
[self runSpinAnimationOnView:_imageView duration:1.0 rotations:360 repeat:1.0]
Now I also want to resize the image of one image, but with an equal share on all sides. How can i do this.
Simply, I want to rotate the UIImageView and resize it at the same time.
thank
source
share