4
  1. My main view controller calls presentViewController to display a configuration screen.
  2. A button on that configuration screen calls presentViewController to allow the user to select a photo.
  3. Once the second view controller is dismissed, the first view controller is redrawn under the status bar on iOS 6 (works fine on iOS 5).

In the viewWillAppear method of the first config controller (the one modally presented) I tried a couple things:

  • Checking the statusBarFrame (it returns 20 on first view; 20 on following views)
  • Checking the main screen's frame (it returns {{0, 20}, {320, 460}} on first view, {0, 0} on following views)
  • Manually setting the y coordinate of the frame to 20 (iOS changes it back to 0 even though the autoresizing mask is set to none)

At this point I can't think of anything except manually moving all the subviews down 20 pixels, which is super janky. Any thoughts as to what might be causing this?

What has changed in iOS 6 that might cause this?

Aaron Brager
  • 65,323
  • 19
  • 161
  • 287
  • hi, I have the same problem with iOS 7. I have tried your solution but it's still there. Do you know how to fix it for iOS 7. Thanks – sahara108 Jul 07 '14 at 07:18

1 Answers1

4

I'm not sure why, but this was fixed by removing the iOS 6 rotation methods, which were unused since the app is portrait-only (shouldAutorotate and supportedInterfaceOrientations).

Aaron Brager
  • 65,323
  • 19
  • 161
  • 287
  • thanks for the update. I too was having this bug and I followed your advice (actually, simply removing the supportedInterfaceOrientations method worked for me). – manderson Mar 19 '13 at 02:22
  • Well, that works. Thanks for sharing. I thought it's AutoLayout related. It happens even in iOS8 (8.1 on my last test). – MkVal Feb 09 '15 at 05:26
  • As it turns out, it also fixes another bug. Same scenario: presenting a modal then closing after. The keyboard just offsets itself somewhere. And from that point on, it keeps offsetting itself everytime you select another textField. But this one is limited to iOS7 only with sparse AutoLayout implementation. – MkVal Feb 09 '15 at 05:37
  • Here's **another** fix if in case you really need to override `-supportedInterfaceOrientation` method: [stackoverflow.com/a/14530123/425694](http://stackoverflow.com/a/14530123/425694). In my case, I had to stick to Portrait orientation on the front `rootViewController`. This overrides my plist configuration for device orientation which was set to support all. Works on both iOS7 and 8. There's a little more work for iOS7 when presenting modals though. – MkVal Feb 09 '15 at 11:12