Kevin Hawkins created CB-1209:
---------------------------------
Summary: CDVViewController.supportedOrientations not set in a
timely fashion
Key: CB-1209
URL: https://issues.apache.org/jira/browse/CB-1209
Project: Apache Cordova
Issue Type: Bug
Components: iOS
Affects Versions: 2.0.0
Environment: Mac OS X Lion, Xcode 4.4, iOS SDK 5.1
Reporter: Kevin Hawkins
Assignee: Shazron Abdullah
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.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira