我目前正在构建一个iPad应用程序,但是想添加一个交互式图像序列。 我尝试过使用内置的动画功能,如下所示:
- (void)viewDidLoad
{
[super viewDidLoad];
NSMutableArray *images = [[NSMutableArray alloc] init];
for (int i = 1; i < 359; i = i+3) {
if(i < 10){
[images addObject:[UIImage imageNamed:[NSString stringWithFormat:@"carredhub1_0000%d.png", i]]];
}
else if(i < 100){
[images addObject:[UIImage imageNamed:[NSString stringWithFormat:@"carredhub1_000%d.png", i]]];
}
else if(i < 1000){
[images addObject:[UIImage imageNamed:[NSString stringWithFormat:@"carredhub1_00%d.png", i]]];
}
}
// Normal Animation
UIImageView *animationImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 400, 400)];
animationImageView.animationImages = images;
animationImageView.animationDuration = 5.0;
[self.view addSubview:animationImageView];
[animationImageView startAnimating];
但是我无法弄清楚如何手动控制它。我想要的是能够设置哪个帧也是动画的,例如右侧滑动会在50帧上移动动画然后动画就可以设置我可以设置哪个帧编号是当前帧和/或设置一个停止帧(我不想增加与滑动速度或长度相关的循环帧数。)
非常感谢任何帮助,谢谢,Will