こんにちは、アニメーションは初めてで、最近遊んでみました。小さなリングから大きなリングに移動し、消えてから、別の場所を除いてプロセスを最初からやり直す円(リング)を表示したい。
これを行うために、同じリングの 6 つの異なるサイズの画像を作成しました。次のコードは私が行った方法ですが、プロセスを繰り返す方法がわかりません(つまり、メソッドを実行しますが、リングの場所は同じままです。乱数ジェネレーターをループする必要がありますが、いつ行うべきかわかりません画像が停止しているかどうかを確認します)。これが正しい方法でない場合は、お知らせください。PSリングは、最大の段階に達するまでに非常に醜く見えますが、理由はわかりません.
ありがとう
-(void) doWork
{
NSInteger number;
NSInteger number2;
NSLog (@"here");
number = (arc4random()%100)+1;
number2 = (arc4random()%100)+1;
NSLog (@" hello numer1: %d", number);
NSLog (@" hello numer2: %d", number2);
imageView = [[UIImageView alloc] initWithFrame:CGRectMake(number, number2, 135, 135)];
imageView.animationImages= [NSArray arrayWithObjects:
[UIImage imageNamed:@"smallestRing.png"],
[UIImage imageNamed:@"smallRing.png"],
[UIImage imageNamed:@"mediumRing.png"],
[UIImage imageNamed:@"large2Ring.png"],
[UIImage imageNamed:@"largeRing.png"], nil];
imageView.animationDuration= 2.5;
imageView.animationRepeatCount= 0;
imageView.contentMode = UIViewContentModeScaleAspectFit;
[imageView startAnimating];
[self.view addSubview:imageView];
/*[NSTimer scheduledTimerWithTimeInterval:5 target:self selector:@selector(doWork) userInfo:nil repeats:YES];*/
}