我有一些意见,我想逐个显示它们。我找不到如何做到这一点。相反,如果我使用下面的代码,所有视图都会一次显示。ios动画一个接一个
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];
}
所有展星功能都是相同的,除了线
[UIView beginAnimations:@"anim1" context:NULL];
[stars[1] setAlpha:1];
其具有不同的参数。 stars
是UIImageView
的数组。 欢迎任何建议。
我已经使用了你的建议,现在屏幕上只显示一个图像,其他人保持隐藏状态。我该怎么办 ? – Teo 2012-02-06 11:00:00
我已经更新了我的答案。 – Ilanchezhian 2012-02-06 11:52:29