iPad Screen Orientation switches to portrait on launch. SDK 1.7.2

You must Login before you can answer or comment on any questions.

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 3 years ago by Brian Blankenship
answer permalink
5 Comments
  • 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 3 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 3 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 3 years ago by Keith Storm

  • Show 2 more comments

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,
    Titanium.UI.UPSIDE_PORTRAIT,
    Titanium.UI.LANDSCAPE_LEFT,
    Titanium.UI.LANDSCAPE_RIGHT,
    Titanium.UI.FACE_UP,
    Titanium.UI.FACE_DOWN]
as a result of which it will support all orientation modes(guess that was what you were expecting to perform).

Your Answer

Think you can help? Login to answer this question!