title: Flip View Iphone
body: <p>please consider the code below, and tell me what I'm doing wrong.</p>
  
  <p>I want to flip between two UIViews.</p>
  
  <p>Somehow, when I flip away from the initial view, I just get the flipped view, without animation. When I flip back, the animation shows just fine.</p>
  
  <p>The flips are triggered from buttons on the views themselves.</p>
  
  <pre><code>- (IBAction)showMoreInfo:(id)sender
  {
      UIView *moreInfo = self.flipView;
  
      [UIView beginAnimations:nil context:nil];
      [UIView setAnimationDuration:2.0];
      [UIView setAnimationBeginsFromCurrentState:NO];
      [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self.view cache:YES];
  
      UIView *parent = self.view.superview;
      [self.view removeFromSuperview];
  
      [parent addSubview:moreInfo];
  
      [UIView commitAnimations];
  
  }
  
  
  
  - (IBAction)showLessInfo:(id)sender
  {
      UIView *lessInfo = self.view;
  
      [UIView beginAnimations:nil context:nil];
      [UIView setAnimationDuration:2.0];
      [UIView setAnimationBeginsFromCurrentState:NO];
      [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.flipView cache:YES];
  
      UIView *parent = self.flipView.superview;
      [self.flipView removeFromSuperview];
  
      [parent addSubview:lessInfo];
  
      [UIView commitAnimations];
  
  }
  </code></pre>