Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.0.0
-
None
-
Mac OS X Lion, Xcode 4.4, iOS SDK 5.1
Description
The iOS template app (reasonably) expects to be able to access its viewController's `supportedOrientations` property to process the app's supported orientations, in `application:didFinishLaunchingWithOptions:`. However, supportedOrientations is not set until `CDVViewController`'s `viewDidLoad` method, which isn't called until the window is made visible. This trickles down into the status bar being forced into a state of `UIDeviceOrientationUnknown` by the forceStartupRotation functionality in the app delegate.
What's more, when the status bar orientation is forced by setting UIApplication's statusBarOrientation property explicitly, it will no longer adhere to any autorotation behavior. This means that the status bar is permanently set into an unknown state, which basically impacts the main view size, since [[UIScreen mainScreen] applicationFrame] assumes an unknown state means that it gets the whole device frame for its area.
Making the window visible before testing the orientations is a workaround, but arguably the initial setting of the supportedOrientations property should happen outside of the view lifecycle (i.e. in the `init` functionality of CDVViewController), since it has no dependency on any UI state--it reads `UISupportedInterfaceOrientations` configuration data from the app bundle to determine valid orientations.