0

当我启动我的应用程序并从 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"];
}
4

1 回答 1

0

使用 FlipSideViewController 的 ViewDidAppear 委托方法来调用您的 -animate 方法

于 2012-11-19T07:12:34.840 回答