私はいくつかのビューを持っており、それらを1つずつ表示したいと考えています。私はこれを行う方法を見つけることができません。代わりに、次のコードを使用すると、すべてのビューが一度に表示されます。iosアニメーションを1つずつ
NSTimer *timer1 = [NSTimer scheduledTimerWithTimeInterval:2 target:self selector:@selector(showStar2) userInfo:nil repeats:NO];
NSTimer *timer2 = [NSTimer scheduledTimerWithTimeInterval:2 target:self selector:@selector(showStar3) userInfo:nil repeats:NO];
NSTimer *timer3 = [NSTimer scheduledTimerWithTimeInterval:2 target:self selector:@selector(showStar4) userInfo:nil repeats:NO];
NSTimer *timer4 = [NSTimer scheduledTimerWithTimeInterval:2 target:self selector:@selector(showStar5) userInfo:nil repeats:NO];
[timer1 fire];
[timer2 fire];
[timer3 fire];
[timer4 fire];
-(void)showStar2
{
[UIView beginAnimations:@"anim1" context:NULL];
[UIView setAnimationDuration:0.5];
[stars[1] setAlpha:1];
[UIView commitAnimations];
}
すべてshowStar関数は異なる引数を持つライン
[UIView beginAnimations:@"anim1" context:NULL];
[stars[1] setAlpha:1];
除いて同一です。 stars
はUIImageView
の配列です。 ご提案は大歓迎です。
あなたの提案を使用しましたが、今度は画面上に1つの画像しか表示されません。 。他は隠れたままです。私は何をすべきか ? – Teo
私は自分の答えを更新しました。 – Ilanchezhian