One of the great benefits to users with current smartphones is the ability to hold the device in any way possible and have the screen rotate to suit its orientation. Titanium allows you to fire event handlers based on orientation changes in your application.
In this recipe, we will create an event handler that fires whenever the orientation on the device is changed, and we will re-arrange some UI components on our screen accordingly.
Open your app.js
file, remove any existing code, and type in the following:
// // create root window // var win1 = Titanium.UI.createWindow({ title:'Tab 1', backgroundColor:'#fff' }); //set the allowed orientation modes for win1 //in this example, we'll say ALL modes are allowed win1.orientationModes = [ Titanium.UI.LANDSCAPE_LEFT, Titanium.UI.LANDSCAPE_RIGHT, Titanium.UI.PORTRAIT, Titanium...