アプリの起動時にアニメーションを追加したい.すべてがiPadシミュレーターでうまく機能します.しかし、実際のiPadで実行すると、フレームはしばらく静止し、その後アニメーションを開始します. すべてのフレームが表示される前に、アニメーションは終了します。これが私のコードです
- (void)viewDidAppear:(BOOL)animated
{
NSArray *myImages = [NSArray arrayWithObjects: [UIImage imageNamed:@"1.png"],
[UIImage imageNamed:@"2.png"],
[UIImage imageNamed:@"3.png"],
[UIImage imageNamed:@"4.png"],
[UIImage imageNamed:@"5.png"],
[UIImage imageNamed:@"6.png"],
[UIImage imageNamed:@"7.png"],
[UIImage imageNamed:@"8.png"],
[UIImage imageNamed:@"9.png"],
[UIImage imageNamed:@"10.png"],
[UIImage imageNamed:@"11.png"],
[UIImage imageNamed:@"12.png"],
[UIImage imageNamed:@"13.png"],
[UIImage imageNamed:@"14.png"],
[UIImage imageNamed:@"15.png"],
[UIImage imageNamed:@"16.png"],
[UIImage imageNamed:@"17.png"],
[UIImage imageNamed:@"18.png"],
[UIImage imageNamed:@"19.png"],
[UIImage imageNamed:@"20.png"],
[UIImage imageNamed:@"21.png"],
[UIImage imageNamed:@"22.png"],
[UIImage imageNamed:@"23.png"],
[UIImage imageNamed:@"24.png"],
[UIImage imageNamed:@"25.png"],
[UIImage imageNamed:@"26.png"],
[UIImage imageNamed:@"27.png"],
[UIImage imageNamed:@"28.png"],
[UIImage imageNamed:@"29.png"],
[UIImage imageNamed:@"30.png"],
[UIImage imageNamed:@"31.png"],
[UIImage imageNamed:@"32.png"],
[UIImage imageNamed:@"33.png"],
[UIImage imageNamed:@"34.png"],
[UIImage imageNamed:@"35.png"],
[UIImage imageNamed:@"36.png"],
[UIImage imageNamed:@"37.png"],
[UIImage imageNamed:@"38.png"],
nil];
//myAnimatedView is UIImageView outlet
myAnimatedView.animationImages = myImages;
myAnimatedView.animationDuration = 3;
myAnimatedView.animationRepeatCount = 1;
[myAnimatedView startAnimating];
//trigger animationDone method when animation is finished
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, myAnimatedView.animationDuration * NSEC_PER_SEC);
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
[self animationDone];
});