アニメーションの作成方法や、それを Xcode に組み込む方法がわかりません。誰かがこれに関する背景情報を教えてもらえますか?
5695 次
2 に答える
5
NSArray *animationArray = [NSArray arrayWithObjects:[UIImage imageNamed@"firstImage",[UIImage imageNamed@"secondImage",nil]; //add as many as you want
次に、アニメーションを次のように設定するためのイメージビューが必要です。
self.myImageView.animationImages =animationArray;
self.myImageView.animationDuration = 3;
self.myImageView.animationRepeatCount = -1; //keeps going infinitely
[self.myImageView startAnimating];
于 2013-01-02T22:05:50.247 に答える
0
あなたがやりたいことは、ビューの遷移をアニメーション化するのではなく、アニメーション化されたイメージを作成することだと思います... iOS 用のアニメーションを作成する 2 つの方法の背景を少し説明します。
最初のオプション: 画像 (UIImage) の配列を作成してから、startAnimating メソッドを使用します。このようなもの:
imageView.image = yourLastImage;
// Do this first so that after the animation is complete the image view till show your last image.
NSArray * imageArray = [[NSArray alloc] initWithObjects:
[UIImage imageNamed:@"image1.png"],
[UIImage imageNamed:@"image2.png"],
[UIImage imageNamed:@"image3.png"],
[UIImage imageNamed:@"image4.png"],
nil];
// Note: here you may instead want to use something like [UIImage imageWithContentsOfFile:[self localImagePath:NO]] instead depending upon your targeted iOS version.
UIImageView * animatedImageView = [[UIImageView alloc] initWithFrame:
CGRectMake(100, 125, 150, 130)];
animatedImageView.animationImages = imageArray;
animatedImageView.animationDuration = 1.1;
myAnimation.animationRepeatCount = 1;
animatedImageView.contentMode = UIViewContentModeBottomLeft;
[self.view addSubview:animatedImageView];
[animatedImageView startAnimating];
2 番目のオプション: (iOS 4 以降の場合) ブロックベースの方法を使用できます。ここでは、StackOverflow の参照記事へのリンクを示します。
iPhone OS 4.0 のブロックベースのアニメーション メソッドとは何ですか?
また、Core Animation に関連して Apple が提供するドキュメントも参照してください。
于 2013-01-02T22:04:20.520 に答える