我正在设置动画uiimageview,在主视图中有按钮,每个按钮通过向imageView的视图发送一个整数来设置要在imageView中设置动画的图像数组。 然后在一个开关的情况下,它填充了数组并开始制作动画。
(void)viewWillAppear:(BOOL)animated {
switch (CurrentPlay) {
case 1:{
flags.animationImages=[NSArray arrayWithObjects:[UIImage imageNamed:@"uae1.tiff"],
[UIImage imageNamed:@"uae2.tiff"],[UIImage imageNamed:@"uae3.tiff"],
[UIImage imageNamed:@"uae4.tiff"],nil];
break;
}
case 2:{
flags.animationImages= [NSArray arrayWithObjects:[UIImage imageNamed:@"lib1.tiff"],
[UIImage imageNamed:@"lib2.tiff"],[UIImage imageNamed:@"lib3.tiff"],
[UIImage imageNamed:@"lib4.tiff"],[UIImage imageNamed:@"lib5.tiff"],[UIImage imageNamed:@"lib6.tiff"],[UIImage imageNamed:@"lib7.tiff"],nil];
[flags reloadInputViews];
break;
}
case 3:{
flags.animationImages=[NSArray arrayWithObjects:[UIImage imageNamed:@"egy1.tiff"],
[UIImage imageNamed:@"egy2.tiff"],[UIImage imageNamed:@"egy3.tiff"],
[UIImage imageNamed:@"egy4.tiff"],nil];
break;
}
default:
break;
}
flags.animationDuration=1.1;
flags.animationRepeatCount = 0;
[flags startAnimating];
[flags release];
其中"标志"是imageView,虽然我发布了它。第一个按钮正确设置动画图像,但是当我回到主视图时,单击另一个按钮,它会进入上面提到的视图,但图像仍然是过去的图像,它没有改变!
调试时,应用程序每次都没有问题进入switch case,但为什么不改变?