我有三个图像和一个图像视图,我希望逐个显示每个图像,并在3秒后在imageview中重复。任何人都可以给我一些建议或链接吗?提前致谢
答案 0 :(得分:2)
您可以使用NStimer方法在一段时间后控制更改。尝试着它。
答案 1 :(得分:1)
您可以使用UIImageView
的动画功能来实现此目的。
// create the view that will execute our animation
UIImageView *campFireView = [[UIImageView alloc] initWithFrame:self.view.frame];
// load all the frames of our animation
campFireView.animationImages = [NSArray arrayWithObjects:
[UIImage imageNamed:@"yourImage01.png"],
[UIImage imageNamed:@"yourImage02.png"],
[UIImage imageNamed:@"yourImage03.png"],
nil];
// all frames will execute in 3 seconds
campFireView.animationDuration = 3;
// repeat the annimation forever
campFireView.animationRepeatCount = 0;
// start animating
[campFireView startAnimating];
//Add imageView to view
[self.view addSubview:campFireView];
选中此tutorial