Note that there are some explanatory texts on larger screens.

plurals
  1. POStatusbar and layout issues with UIImagePickerController after rotation
    primarykey
    data
    text
    <p>tl;dr: User interface layout is broken when rotating the iPad while taking a photo, if the app displays a status bar.</p> <p>I've got an app that shows a status bar that should take photos through a <code>UIImagePickerController</code>.</p> <p>I'm running this on an iPad 3, iOS 6 with Xcode 4.51</p> <p>The first problem I noticed was that if I didn't hide the statusbar via </p> <pre><code>[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone]; </code></pre> <p>before the call to</p> <pre><code>[self presentViewController:imagePicker animated:YES completion:nil]; </code></pre> <p>Then the <code>UIImagePickerController</code> would not be shown correctly on the screen. The space for the status bar would still be reserved (but no time or battery information etc. shown) with the result that the controls at the lower end of the screen would be partly off-screen.</p> <p>So, I added the line </p> <pre><code>[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone]; </code></pre> <p>before presenting the <code>UIImagePickerController</code> and the first problem was solved.</p> <p>Now comes the second problem (caused by the solution to the first problem). When I bring up the <code>UIImagePickerController</code>, rotate the iPad and close it (via "cancel" or "use", doesn't matter), the handler (either <code>imagePickerControllerDidCancel</code> or <code>imagePickerController:didFinishPickingMediaWithInfo:</code> gets called, in which I show the status bar again, via</p> <pre><code>[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationNone]; </code></pre> <p>The problem is now that the status bar is shown in fact, but the rest of the app seems to be unaware that it is on the screen again. (The UIToolbar that I have on my "MainViewController" is partly hidden behind the status bar.) The interesting thing is, if I rotate the iPad to any other orientation all is displayed correctly again after the animation finishes.</p> <p>Can anybody give me any tips on how to solve this problem? (Currently my best work around would be to leave the status bar hidden after the first time somebody took a photo, but that's kind of sub-optimal). Maybe there is a better solution to the first problem, or maybe a method to solve both issues.</p> <p>Further information: After rotating the iPad to landscape while <code>UIImagePickerController</code> was active, this is the frame of my MainViewController's view frame: {{0, 0}, {1024, 768}} (i.e. in the case where there is the problem). When I have the iPad in landscape orientation all the time, this is the MainViewController's view frame after the <code>UIImagePickerController</code> is dismissed: {{0, 0}, {1024, 748}} (This is the case where there is no problem.)</p> <p>Thanks in advance for your attention and effort!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload