Create a gist now

Instantly share code, notes, and snippets.

AppTemplate for Titanium tutorial
(function(){
var Mods = require('/ModulePaths');
var TabGroup = require(Mods.TABGROUP);
var tabGroup = new TabGroup();
tabGroup.open();
})();
//avoid initial slash in paths under mobileweb platform
var firstSeparator = (Ti.Platform.name === 'mobileweb') ? '' : '/';
var ui = firstSeparator + 'app/ui/';
module.exports = {
TABGROUP: ui + 'TabGroup',
WINDOW1: ui + 'Window1',
WINDOW2: ui + 'Window2',
WINDOW3: ui + 'Window3',
STYLES: ui + 'Styles'
}
var Mods = require('/ModulePaths'); //load module paths
var Window1 = require(Mods.WINDOW1),
Window2 = require(Mods.WINDOW2),
Window3 = require(Mods.WINDOW3);
module.exports = function(_args) {
var tabGroup = Ti.UI.createTabGroup();
var win1 = new Window1();
var win2 = new Window2();
var win3 = new Window3();
var tab1 = Ti.UI.createTab({
window: win1,
title:'Window 1',
icon:'KS_nav_ui.png'
});
var tab2 = Ti.UI.createTab({
window: win2,
title:'Window 2',
icon:'KS_nav_views.png'
});
var tab3 = Ti.UI.createTab({
window: win3,
title:'Window 3',
icon:'KS_nav_ui.png',
});
tabGroup.addTab(tab1);
tabGroup.addTab(tab2);
tabGroup.addTab(tab3);
return tabGroup;
};
module.exports = function(){
var win = Ti.UI.createWindow({
backgroundColor:'#fff',
title: 'win 1'
});
var lbl = Ti.UI.createLabel({
text:'This is Window 1',
color:'#333'
});
win.add(lbl);
return win;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment