0
votes

Looking for a solution to an autorotation issue using UISplitViewController. The steps to re-create are:

  1. Using Xcode 4.5+ and the iOS6+ SDK, create a new project using the "Master-Detail Application: template.
  2. Add a new view controller to the project with a XIB file that is full screen in size.
  3. Add a button to the detail view controller that presents the new view controller full screen using -presentViewController:animated:completion:
  4. Add a button to the new view controller that dismisses the itself using dismissViewControllerAnimated:completion:
  5. Start the app with the iPad in landscape mode and hit the button created in step 3 in the detail view that presents the new view controller.
  6. While viewing the full screen view controller, rotate the iPad to portrait and then tap the button added in step 4 to dismiss the new view controller.

THE PROBLEM: Using these steps, both the master and detail view controller will auto-rotate but the master view controller will stay on the screen in an unresponsive state and taking up a frame in the upper left of the screen that is the same size as it was in landscape mode. By using a gesture from the left side of the iPad, the correct master view controller will be displayed and the issue is cleared.

We have been able to use viewWillAppear and viewDidDisappear in the new view controller to make the phantom master view controller hide, but even with that fix, the "Master" button that the template provides in portrait remains unresponsive after following the above steps, and we have traced it to the fact that the region of the screen in the upper left taken up by the master view controller prior to the fix is unresponsive to touch.

We have tried a few attempts at resigning the first responder in different ways but have had no luck completely fixing the issue.

NOTE: This issue only usually happens if the above Steps 5-6 are followed when first launching the app. Repeating step 6 within a single app launch usually does not result in the issue every time. It is repeatable on every launch of the app.

1

1 Answers

0
votes

Found a fix for this.

  1. Set the modal presentation style of the view controller to UIModalPresentationPageSheet prior to the call to presentViewController:animated:completion:.
  2. Then, did an override of the view controllers -viewWillLayoutSubviews method to manually set the bounds of the superview to match the screen size, 768x1004 for portrait and 1024x748 for landscape.