views:

489

answers:

0

I am having a problem trying to animate between 2 UIImage.

I did implement the setAnimationDidStopSelector methods so once my first animation is finish I start my second one, but when I tried to flip to my previous image it still flipping to the same image as if the variable didn't take into the account the new value of my image object :-(.

I am doing something like this to switch from img1 to img2 :

Code:

  [UIView beginAnimations:@"first" context:nil];
  [UIView setAnimationDuration:3];
  [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self cache:YES];
  [UIView setAnimationDelegate:self];
  [UIView setAnimationDidStopSelector:@selector(animationFinish:finished:context:)];
  placardImage = img2;
  [UIView commitAnimations];

Then in the animationFinish I am switching from img2 to img1 like this :

Code:

if ((animationID1 == @"first")) {
 [UIView beginAnimations:@"zozo" context:self];
 [UIView setAnimationDuration:3];
 [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self cache:NO];
 placardImage = img1;
 [UIView commitAnimations];
}

But the result I saw on the screen, is that I see my first flip work (flipping from img1->img2). But when I am trying to re flipping from img2->img1 what I see on the screen is img2->img2.

Any ideas why?

It has been 1 week I am trying to debug this and still didnt find a working solution.

Any help will be greatly appreciated.

Thanks for your collaboration in advance.

Fred