title: Strange behavior of UIView animation during transition
body: <p>I'm navigating from one view controller to the next using a segue (modal). However I am using a custom segue so that no animation is involved when the transition happens. Instead i have my own animation on the subviews inside the view controller (view). Everything works fine here. 
  But when I move back to my view controller from the presented view controller using <code>dismissModalViewControllerAnimated:</code> there is a small hiccup.
  The following is the code where i am calling the method from the destination view controller.</p>
  
  <pre><code>[UIView animateWithDuration:1.0 delay:0.0 options:UIViewAnimationOptionTransitionCrossDissolve animations:^{
  
          [self dismissModalViewControllerAnimated:NO];
  
      } completion:nil];
  </code></pre>
  
  <p>I have the following code in <code>viewWillAppear</code> of the parent view controller</p>
  
  <pre><code>-(void)viewWillAppear:(BOOL)animated{
      ContainerView *containerView = (ContainerView *)[[[self.view subviews]objectAtIndex:0] viewWithTag:CONTAINER_TAG];
  
      int i=0;    
      for (UIView *vw in containerView.subviews) {
          [vw setFrame:[[containerView.initialFrameArray objectAtIndex:i] CGRectValue]];
          i++;
      }      
  }
  </code></pre>
  
  <p>This also works fine with all my animations coming properly as long as it is in the portrait mode. When its in any other orientation, the animation still works but there is an additional rotation of the whole view as if the orientation of the whole device was changed from portrait to the current orientation. Its as if the orientation of the parent view controller (view) is stored as portrait. And when the <code>dismissModalViewControllerAnimated:</code> is called, even if the device is in landscape orientation the whole view rotates  to come to the landscape view again.  </p>
  
  <p>Is there any way to change the orientation (stored) of the parent view controller to landscape before I dismiss the modal view controller?</p>
  
  <p>Or am I doing anything wrong in implementing my custom animation?</p>