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"];
}
這就是它!謝謝! –