ShowTable of Contents
window.open properties
animated
Set to true to have an animation while opening a window.
Set to false to open without animation.
modal
Set to true to have open a modal window.
Use together with:
modalTransitionStyle : Ti.UI.iPhone.MODAL_TRANSITION_STYLE_FLIP_HORIZONTAL,
modalStyle : Ti.UI.iPhone.MODAL_PRESENTATION_FULLSCREEN
Define which orientations are allowed
Set one or more modes for the 'orientationModes' property:
win = Ti.UI.createWindow({
orientationModes : [
Ti.UI.PORTRAIT,
Ti.UI.UPSIDE_PORTRAIT,
Ti.UI.LANDSCAPE_LEFT,
Ti.UI.LANDSCAPE_RIGHT
]
})
Force an orientation at startup
You can use Ti.UI.orientation to check which orientation the device currently has. And you can set this property to change the orientation of the device.
Example: force to landscape:
if (Ti.UI.orientation != Ti.UI.LANDSCAPE_LEFT && Ti.UI.orientation != Ti.UI.LANDSCAPE_RIGHT) {
if (Ti.UI.orientation == Ti.UI.PORTRAIT) {
Ti.UI.orientation = Titanium.UI.LANDSCAPE_RIGHT;
} else if (Ti.UI.orientation == Ti.UI.UPSIDE_PORTRAIT) {
Ti.UI.orientation = Titanium.UI.LANDSCAPE_LEFT;
} else {
Ti.UI.orientation = Titanium.UI.LANDSCAPE_RIGHT;
}
}
Create a modal window
win.open({
modal : true,
modalTransitionStyle : Ti.UI.iPhone.MODAL_TRANSITION_STYLE_FLIP_HORIZONTAL,
modalStyle : Ti.UI.iPhone.MODAL_PRESENTATION_FULLSCREEN
});
Windows with navigation bar
The navigation bar is in the title bar of a window and allows to go back to a previous window.
as tabgroup
App.tabGroup = Titanium.UI.createTabGroup();
// create win1, win2...
App.tab1 = Titanium.UI.createTab({
icon:'KS_nav_views.png',
title:'Tab 1',
window:App.win1
});
// ...
App.tabGroup.addTab(App.tab1);
App.tabGroup.open();
// open a new window with jump back button
App.tab1.open(win, {animated:true})
show or hide the navbar
win.showNavBar({animated:false});
win.showNavBar({animated:true});
win.hideNavBar({animated:false});
win.hideNavBar({animated:true});
set custom label or view for the navbar title
var mylabel = Ti.UI.createLabel(...);
win.setTitleControl(mylabel);
with navigationgroup
see Titanium API documentation for Ti.UI.iPhone.NavigationGroup