Moving UIViewController from one window to another breaks rotation in iOS 8.1

Originator:steipete
Number:rdar://18906964 Date Originated:07-Nov-2014 12:38 PM
Status:Open Resolved:
Product:iOS 8 Product Version:
Classification: Reproducible:Always
 
eter Steinberger07-Nov-2014 12:38 PM

Summary:
Moving a UIViewController instance from the main window to a different window by setting it as the rootViewController breaks rotation behavior on iOS 8.1. This is a regression that first occurred in iOS 8.1. iOS 8.0.x and iOS 7.x are not affected.

Steps to Reproduce:
Download the attached example project and perform the following steps:

1. Run on iPhone with iOS 8.1
2. Tap the "New Controller" button while in portrait mode
3. Notice that the blue view is now in fullscreen
4. Rotate the device to landscape
5. Notice that the rotation works properly
6. Rotate back to landscape
7. Dismiss by tapping the blue view
8. Tap the "Re-use Controller" button while in portrait mode
9. Notice that the blue view is now in fullscreen
10. Rotate to landscape
11. Notice that the landscape view is not properly sized
12. Restart the app before trying again to restore the initial state

Expected Results:
The blue view is properly sized to occupy the entire UIWindow.

Actual Results:
The blue view is improperly sized.

Version:
iOS 8.1

Notes:
Also broken in iOS 8.1.1b1. Affects both iPad and iPhone.

Configuration:
iPad Air 2

Attachments:
'Archive.zip' was successfully uploaded.
http://cl.ly/3U0b1N0h2L2a/download/UIViewController-Window-Rotation%20(rdar%3A%3A18906964).zip

Comments

Workaround

I've finally found a workaround for this:

https://gist.github.com/steipete/d7ee1219cbb2dd67cedc

But ugh... we're using undocumented things to clean up the VC state here. Not great.


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!