var win = Ti.UI.createWindow({
orientationModes: [Ti.UI.PORTRAIT, Ti.UI.UPSIDE_PORTRAIT]
});
var navWin = Ti.UI.iOS.createNavigationWindow({window: win});
var button = Ti.UI.createButton({
width: 200,
height: 50,
title: "Open Window 2"
});
button.addEventListener("click", function() {
var win2 = Ti.UI.createWindow({
orientationModes: [Ti.UI.PORTRAIT, Ti.UI.UPSIDE_PORTRAIT, Ti.UI.LANDSCAPE_LEFT, Ti.UI.LANDSCAPE_RIGHT]
});
navWin.openWindow(win2);
});
win.add(button);
win.open();
First of all this problem only shows on a real device.
Start the app in Portrait mode, click the "Open Window 2"-button and place the phone i Landscape mode, press the navigation window back button to return to the first window, this should force the app to be rotated back into Portrait mode according to forced orientation and by just looking at the window it looks correct but if you now place your phone back into Portrait mode the window will rotate once more back into Portrait mode giving a weird effect.
Refer to [orientationModes](http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.UI.Window-property-orientationModes) *Forcing the orientation of windows inside a NavigationWindow is a bad practice* *OrientationModes must be set before opening the window.*