2012-11-19 28 views
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"]; 
} 

回答

0

flipSideViewController使用ViewDidAppear委托方法调用你-animate方法

+0

这就是它!谢谢! –

相关问题