1

iPhone アプリの基本的なアニメーションを作成しています。2 種類のアニメーションから選択できます。これは使える…

NSArray *myImages = [NSArray arrayWithObjects: 
[UIImage imageNamed:@"myImage1.png"], 
[UIImage imageNamed:@"myImage2.png"], 
[UIImage imageNamed:@"myImage3.png"], 
[UIImage imageNamed:@"myImage4.gif"], nil]; 

UIImageView *myAnimatedView = [UIImageView alloc]; 
[myAnimatedView initWithFrame:[self bounds]]; 
myAnimatedView.animationImages = myImages; 
myAnimatedView.animationDuration = 0.25;  
[self addSubview:myAnimatedView]; 
[myAnimatedView release];

またはこのようなもの...

    [UIView beginAnimations:nil context:NULL];
 [UIView setAnimationDuration:1.5];
 // other animations goes here
 myImage.transform = CGAffineTransformMakeRotation(M_PI*0.5);
 // other animations goes here
 [UIView commitAnimations];

アニメーション化するパーツがかなりあるので、使用するメモリ量が最も少なく、実行速度が最も速いオプションを選択したいと考えています。どんなアドバイスでもいいです、ありがとう

4

3 に答える 3

0

あなたの質問で説明する変数はたくさんあります。その多くは、画像のサイズと複雑さ、およびアニメーションが実行される頻度に依存します。私の勘では、APIが提供する変換を使用するのが最も安価ですが、実際に判断する唯一の方法は、両方のアニメーションのストレステストを行い、どちらが最適かを確認することです。

于 2010-05-04T14:26:14.973 に答える
0

私ならハイブリッドにします: アニメーション コードから静止画像を生成し、レイヤーを CGImages に保存します。

于 2010-05-04T19:55:18.120 に答える