Frage

I create a animation :

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];

It is working but I need to change my animatView position. How can I do that? For first image and for second frame will be different.

Any ideas?

If it be a group of animation, how can I change frame for every animation?

Thanks for help!

Edit #1:

For three images to animate I use this, but it's not working fine. First it change frame then work first animation.

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];
War es hilfreich?

Lösung

With the way you are doing the animation, I don't think it's possible. But you can do that with UIView animation blocks like :

[UIView animateWithDuration:<#(NSTimeInterval)#> animations:^{
    <#code#>
}]; 
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top