2012-11-19 27 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

這就是它!謝謝! –

相關問題