title: iPad/iOS7: 'Page' modal view controller strange behaviour after presenting 'Full screen' view controller from it
body: <p>My iPad application opens modal view controller with 'Page' presentation style. As you know 'Page' presentation style doesn't cover status bar of presenting view controller to indicate page presentation.</p>
  
  <p><img src="https://i.stack.imgur.com/StPF2.png" alt="Initial view controller"></p>
  
  <p><img src="https://i.stack.imgur.com/iDeBJ.png" alt="Page modal view controller"></p>
  
  <p>From the modal view controller the app opens <code>UIImagePickerController</code> to make photo. <code>UIImagePickerController</code> has 'Full screen' presentation style. After dismissing image picker presenting modal view controller become 20px taller and overlaps status bar of the initial view controller. </p>
  
  <p>I tried to replace <code>UIImagePickerController</code> with simple <code>UINavigationController</code> and it breaks my modal view controller too.</p>
  
  <p>There are screen shots:
  <img src="https://i.stack.imgur.com/V3vCK.png" alt="Full screen view controller"></p>
  
  <p><img src="https://i.stack.imgur.com/lSfoA.png" alt="Broken modal view controller"></p>
  
  <p>They only way to restore size of 'Page' view controller is changing height of <code>viewController.view.superview.superview.superview.superview</code> frame after returning to 'Page' view controller. But it's really weird.</p>
  
  <p>Is there another way to fix 'Page' modal view controller presentation after dismissing nested modal view controller?</p>
  
  <p><strong>UPDATE:</strong>
  I used such weird code to solve my problem:</p>
  
  <pre><code>#define STATUS_BAR_HEIGHT 20
  #define IPAD_PORTRAIT_HEIGHT 1004
  #define IPAD_LANDSCAPE_HEIGHT 748
  UIView *superview = nil;
  
  // In case of this view controller included in navigationController we have to use superview of navigation's controller view
  if (self.navigationController)
      superview = self.navigationController.view.superview;
  else
      superview = self.view.superview;
  
  CGRect r = superview.frame;
  
  // Sometimes we have to fix height + origin, sometimes only height (becase view has bottom magnifying)
  // In landscape orientation we have to fix 'width' instead of 'height', because that view controller always works in 'portrait' mode
  if (self.interfaceOrientation == UIInterfaceOrientationPortrait &amp;&amp; r.size.height &gt; IPAD_PORTRAIT_HEIGHT) {
      r.origin.y = STATUS_BAR_HEIGHT;
      r.size.height = IPAD_PORTRAIT_HEIGHT;
  }
  else if (self.interfaceOrientation == UIInterfaceOrientationMaskPortraitUpsideDown &amp;&amp; r.size.height &gt; IPAD_PORTRAIT_HEIGHT) {
      r.size.height = IPAD_PORTRAIT_HEIGHT;
  }
  else if (self.interfaceOrientation == UIInterfaceOrientationLandscapeLeft &amp;&amp; r.size.width &gt; IPAD_LANDSCAPE_HEIGHT) {
      r.size.width = IPAD_LANDSCAPE_HEIGHT;
      r.origin.x = STATUS_BAR_HEIGHT;
  }
  else if (self.interfaceOrientation == UIInterfaceOrientationLandscapeRight &amp;&amp; r.size.width &gt; IPAD_LANDSCAPE_HEIGHT) {
      r.size.width = IPAD_LANDSCAPE_HEIGHT;
  }
  
  superview.frame = r;
  </code></pre>
  
  <p>I don't believe that there is no more elegant solution. Any ideas how to improve it?</p>
  
  <p><strong>UPDATE2:</strong> I've just opened a bug. You can follow it there: <a href="http://openradar.appspot.com/radar?id=4910948821237760" rel="noreferrer">rdar://15949644</a></p>
  
  <p><strong>UPDATE3:</strong> There is my sample project: <a href="http://vitaly.org.ua/stackoverflow/PageTest.zip" rel="noreferrer">link</a></p>