[英]How to begin animation when view is displayed?
當我啟動應用程序並從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"];
}
使用flipSideViewController的ViewDidAppear委托方法來調用-animate方法
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.