によりアニメーションを制御....iはコードのこのタイプを有するタッチ
// create a UIImageView
UIImageView *rollDiceImageMainTemp = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"rollDiceAnimationImage1.png"]];
// position and size the UIImageView
rollDiceImageMainTemp.frame = CGRectMake(0, 0, 100, 100);
// create an array of images that will represent your animation (in this case the array contains 2 images but you will want more)
NSArray *savingHighScoreAnimationImages = [NSArray arrayWithObjects:
[UIImage imageNamed:@"rollDiceAnimationImage1.png"],
[UIImage imageNamed:@"rollDiceAnimationImage2.png"],
nil];
// set the new UIImageView to a property in your view controller
self.viewController.rollDiceImage = rollDiceImageMainTemp;
// release the UIImageView that you created with alloc and init to avoid memory leak
[rollDiceImageMainTemp release];
// set the animation images and duration, and repeat count on your UIImageView
[self.viewController.rollDiceImageMain setAnimationImages:savingHighScoreAnimationImages];
[self.viewController.rollDiceImageMain setAnimationDuration:2.0];
[self.viewController.rollDiceImageMain.animationRepeatCount:3];
// start the animation
[self.viewController.rollDiceImageMain startAnimating];
// show the new UIImageView
[self.viewController.view addSubview:self.rollDiceImageMain];
代わりのstartAnimationはtouchesMovedを使用してこのコードを制御する方法をdirectly..there?
私は配列内に一連の画像を持つ画像ビューを持っています... どうすれば使用できますか? m初心者です。私のばかげた質問に申し訳ありません。 – Hisenberg
@ user462533あなたは配列内のそれぞれに対して使用しているUIImageまたはUIImageViewをサブクラス化し、このメソッドを追加します。デフォルトでは、このメソッドではUIViewクラスは何も行いません。そのため、UIViewクラスはそれをオーバーライドする必要があります。 –