Search code examples
iosiphonecocoa-touchuikituiinterfaceorientation

iOS 8: How to implement a rotating view controller on top of a portrait-only app?


My app is portrait-only except one view controller (a fullscreen image viewer) which is presented modally using a custom transition animation.

It all works fine on iOS 7 and 8 as long as the app is built against the iOS 7 SDK. When I compile against iOS 8 SDK, I encounter an interface rotation problem running on iOS 8: When the image viewer is rotated to landscape and then dismissed, the layout of the presenting view controller is broken. It's back to portrait but with landscape dimensions. So the bottom part of the screen is black.

What could be the reason? Currently, I'm only using the iOS 7 interface orientation methods such as -supportedInterfaceOrientations, -shouldAutorotate and -willRotateToInterfaceOrientation:duration:. Since I still need iOS 7 compatibility I didn't switch to the iOS 8 style orientation methods yet.


Solution

  • Turns out that I just forgot to set the final frame of the presenting view controller's view in my custom dismiss animation. For whatever reason, this didn't matter in iOS 7. But in iOS 8 it does.