Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-1209

CDVViewController.supportedOrientations not set in a timely fashion

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0.0
    • 2.1.0
    • cordova-ios
    • 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.

      Attachments

        Activity

          People

            agrieve Andrew Grieve
            khawkins@salesforce.com Kevin Hawkins
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 2h
                2h
                Remaining:
                Remaining Estimate - 2h
                2h
                Logged:
                Time Spent - Not Specified
                Not Specified