title: iPad rotate from portrait to landscape
body: <p>My view is originally in landscape mode. when a button is taped, a view opens in portrait mode and everything is find upto this point. the problem is when I go back from that view to the root view the view won't rotate correctly. here is the code I use to rotate the view from portrait to landscape,</p>
  
  <pre><code>-(void)viewWillDisappear:(BOOL)animated
  {
  [super viewWillDisappear:animated];
  
  //rotate the page to lansscape
  CGAffineTransform landscapeTransform = CGAffineTransformMakeRotation(-90*0.0174532925);
  landscapeTransform = CGAffineTransformTranslate (landscapeTransform, 0.0, 0.0);
  
  [self.navigationController.view setTransform:landscapeTransform];
  
  self.navigationController.view.autoresizingMask = UIViewAutoresizingFlexibleWidth |UIViewAutoresizingFlexibleHeight;    
  self.navigationController.view.frame  = CGRectMake(0.0, 0.0, self.view.frame.size.width, self.view.frame.size.height);
  self.navigationController.view.center  = CGPointMake (384.0, 544.0);
  
  [UIApplication sharedApplication].statusBarOrientation = UIInterfaceOrientationLandscapeLeft;
  }
  </code></pre>
  
  <p>here is a screen shot of the root page in landscape mode after returning from the portrait page,</p>
  
  <p><img src="https://i.stack.imgur.com/71LqI.png" alt="enter image description here"></p>
  
  <p>this is how it should look like</p>
  
  <p><img src="https://i.stack.imgur.com/m5x3p.png" alt="enter image description here"></p>