ShowTable of Contents
layout property In Ti.UI.createWindow() or Ti.UI.createView() you can set the 'layout' property to:
none: All elements are placed in the middle of the screen if you don't use the 'top' property. Does not need 'height' property on elements.
vertical Elements are placed one after eachother in a vertical manner, starting from the top. Elements need 'height' property, otherwise they might not be visible. If a window or view has 'height':'auto', all elements in that window or view needs 'height':'auto', too, or a specific height (as number).
horizontal Elements are place one after eachother in a horizontal manner.
caution with 'auto' for width and height Since Ti SDK 2.0 'auto' is deprecated. Use Ti.UI.SIZE or Ti.UI.FILL instead. Ti.UI.SIZE: fit to content Ti.UI.FILL: fill avaiilable space
Screen sizes iPhone Portrait: 208x480 iPhone Landscape: 356x320 iPad Portrait: 768x1004 iPad Landscape: 1024x768
iPhone Landscape Status Bar height: 20px Nav Bar height: 32px Content Area height: 219px Tab Bar height: 49px Keyboard height: 162px
iPhone Portrait Status Bar height: 20px Nav Bar height: 44px Content Area height: 367px Tab Bar height: 49px Keyboard height: 216px
iPad Landscape Status Bar height: 20px Nav Bar height: 44px Content Area height: 655px Tab Bar height: 49px Keyboard height: 352px
iPad Portrait Status Bar height: 20px Nav Bar height: 44px Content Area height: 911px Tab Bar height: 49px Keyboard height: 264px
force orientation at startup Example: if orientation at startup is not landscape, switch to landscape left or right depending on the current orientation.
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;
}
}
|