iPad Screen Orientation switches to portrait on launch. SDK 1.7.2

Hello everyone. I'm about ready to publish a new version of our app to the iTunes market and there is one bug I'm trying to resolve. On SDK version 1.7.2, the app forces a switch to portrait mode if the device is already in landscape mode. It does not do this in version 1.7.1, but there are other issues caused by version 1.7.1. Is there a way I can fix this issue by specifying orientation in code?

Here is a video showing what is happening.

3 Answers

  • Are you trying to force orientation to Portrait, or just wanting orientation to match the device's orientation?

    I saw the below post recently where someone was having problems forcing orientation on 1.7.2…

    Also, does your Tiapp.xml still retain all 4 orientation entries for iPad?

    Forcing orientation in 1.7.2

    — answered 4 years ago by Brian Blankenship
    • I'm just wanting it to match the device orientation. When in landscape, it starts as landscape, then quickly switches to portrait, even though the device is still in landscape (same in simulator). I double checked the Tiapp.xml and Info.plist file and all 4 orientations are there.

      — commented 4 years ago by Keith Storm
    • ps - sorry - just realized that link was for Android, but the same steps for forcing orientation would apply. Does the app behave the same on a device? Is there any chance somewhere in your code might be forcing orientation (on a hidden window, loading window, splitWindow, etc.)? If you change 'Hardare Device' in the Sim and go back, does it change anything? Also, assuming you have cleaned your build, deleted the app from the simulator/device, before installing again…

      — commented 4 years ago by Brian Blankenship
    • I have performed the "Clean Build" function from within Titanium Studio. I am using a SplitView, but I don't actually do anything orientation specific. It seems to force the rotation during the splash screen (default.png). So I'm assuming it does it before it even starts executing any of my code. It works great on 1.7.1, but on 1.7.1 my leftNavButton is getting distorted on orientation change. Thanks for helping out with this.

      — commented 4 years ago by Keith Storm
    • Just saw this ticket in Jira - which is similar to your issue - iPad, launch, orientation, 1.7.2 (except its wrong landscape direction upon open)… Anyways, sounds like it might be a bug…

      iPad window rotates to the wrong landscape when the app is opened

      — commented 4 years ago by Brian Blankenship
    • Yea. I tried a few of the CI builds also and it seems to still be in there at version 1.8. I just did a quick test by removing all my code from the app.js which made it do virtually nothing after displaying the splash. It still rotated it to the portrait. Oh well. Hope they can figure it out. Thanks!

      — commented 4 years ago by Keith Storm
  • You can force the orientation of your app with:

    Ti.UI.orientation = TI.UI.LANDSCAPE_LEFT;

    or whichever orientation you prefer.

  • Hi,

    As Anthony mentioned you have to mention that specifically on the first Window like this

    win.orientationModes = [Titanium.UI.PORTRAIT,

    as a result of which it will support all orientation modes(guess that was what you were expecting to perform).