我创建了一个动画:
NSArray *animationArr=[[NSArray alloc] initWithObjects:
[UIImage imageNamed:@"FirstPosition@2x"],
[UIImage imageNamed:@"SecondPosition@2x"],nil];
[self.animatView setAnimationImages:animationArr];
[self.animatView setAnimationDuration:2.4];
[self.animatView setAnimationRepeatCount:1];
[self.animatView startAnimating];
它正在工作,但我需要改变我的animatView
立场。我怎样才能做到这一点?对于第一张图像和第二帧将是不同的。
有任何想法吗?
如果是一组动画,如何为每个动画更改帧?
感谢帮助!
编辑#1:
对于三个要制作动画的图像,我使用它,但它不能正常工作。首先它改变框架然后工作第一个动画。
CGRect animatFrame = self.animatView.frame;
[UIView animateWithDuration:self.animatView.animationDuration
animations:^{
self.animatView.frame = CGRectMake(self.animatView.frame.origin.x + 5.5 / 2.0, self.animatView.frame.origin.y + 28.5 / 2.0, self.animatView.frame.size.width, self.animatView.frame.size.height);
self.animatView.frame = CGRectMake(self.animatView.frame.origin.x - 14.0 / 2.0, self.animatView.frame.origin.y - 6.5 / 2.0, self.animatView.frame.size.width, self.animatView.frame.size.height);
}
completion:^(BOOL finished){
self.animatView.frame = animatFrame;
}];
[UIView commitAnimations];