我正在尝试让我的动画在多个生成的路径中移动。我把我的代码写下来了,但是我仍然不明白它有什么问题。
这是我在视图中放置图像的位置
UIImageView *faceAni = [[UIImageView alloc] initWithFrame:CGRectMake(200, 100, 50.0, 50.0)];
faceAni.animationImages = faces;
faceAni.animationDuration = 10;
faceAni.animationRepeatCount = 0;
[faceAni startAnimating];
[self addSubview:faceAni];这就是我尝试让动画在三角形路径坐标中移动的地方。
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1];
[UIView animateWithDuration:4
delay:0
options:UIViewAnimationOptionRepeat|UIViewAnimationOptionAutoreverse
animations:^{faceAni.transform = CGAffineTransformMakeTranslation(0, 200);}
completion:^(BOOL finished) {
[UIView animateWithDuration:4
delay:0
options:UIViewAnimationOptionRepeat|UIViewAnimationOptionAutoreverse
animations:^{faceAni.transform = CGAffineTransformTranslate(faceAni.transform, -100, 0);}
completion:^(BOOL finished) {
[UIView animateWithDuration:4
delay:0
options:UIViewAnimationOptionRepeat|UIViewAnimationOptionAutoreverse
animations:^{faceAni.transform = CGAffineTransformTranslate(faceAni.transform, 300, 0);}
completion:NULL];
}];
}];我仍然不明白我的代码出了什么问题。
提前感谢!
发布于 2011-11-20 10:53:36
如果你描述一下你所看到的行为,可能会有所帮助。不过,作为猜测,您可能不想要传递给每个动画的UIViewAnimationOptionRepeat|UIViewAnimationOptionAutoreverse标志。
https://stackoverflow.com/questions/8198490
复制相似问题