当我启动我的应用程序并从 mainViewController 转到 FlipSideViewController 时,flipSideViewController 中的图像视图将会动画。每次用户从 mainViewController 转换到 FlipSideViewController 时,我都想对其进行动画处理。
这是一些代码:
[self animate];
//Not sure where to put this instance method. Would I put this in a certain method? I have no idea what I would write for it!
- (void)animate
{
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"transform.rotation"];
animation.toValue = [NSNumber numberWithFloat:((-10*M_2_PI)/180)];
animation.duration = .3;
animation.autoreverses = YES;
animation.repeatCount = 4;
animation.speed = 9;
pwAnimation.removedOnCompletion = YES;
[_ImageView.layer addAnimation:pwAnimation forKey:@"rotation"];
}