0

上下にアニメーション化したいシンプルな画像があります...どうすればiPhoneアプリで実現できますか?

助けてください

ありがとう

4

2 に答える 2

2

画像の配列を使用して、1 つの UIImage でアニメーション化できます。

iOS5:

@interface UIImage (WrightsCS)
+(UIImage *)animatedImageWithImages:(NSArray *)images duration:(NSTimeInterval)duration;
@end

if ( SYSTEM_VERSION_GREATER_THAN(@"5.0") )
{
    NSArray *animationFrames = [NSArray arrayWithObjects:
                                [UIImage imageNamed:@"image_0.png"],
                                [UIImage imageNamed:@"image_1.png"],
                                [UIImage imageNamed:@"image_3.png"],
                                [UIImage imageNamed:@"image_4.png"], nil];

    UIImage * animatedImage = [UIImage animatedImageWithImages:animationFrames duration:2.0f];    
} 
于 2012-03-09T04:18:30.807 に答える
0

Core Animation のドキュメントを見たことがありますか?

私がすることは、CALayer を作成し、そのコンテンツに画像を追加することです。ビューのすぐ外側に配置します。UIViewのレイヤーにサブレイヤーとして追加し、このレイヤーの位置をアニメーション化する場所に設定します。

これで、始めるための十分なヒントが得られるはずです。コツをつかめば、より複雑なアニメーションを行うことができます。

于 2012-03-09T04:18:21.120 に答える