当我启动我的应用程序并从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"];
}
答案 0 :(得分:0)
使用flipSideViewController的ViewDidAppear委托方法来调用你的-animate方法