Skip to content

Instantly share code, notes, and snippets.

@flopezluis
Created February 2, 2011 08:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save flopezluis/807418 to your computer and use it in GitHub Desktop.
Save flopezluis/807418 to your computer and use it in GitHub Desktop.
Create 2 tabs
var isAndroid = Ti.Platform.osname == 'android';
// create tab group
var tabGroup = Titanium.UI.createTabGroup();
var indicator = Titanium.UI.createActivityIndicator({
bottom:10,
height:50,
width:10,
message:"Cargando..."
});
function showAct() {
indicator.show();
}
function hideAct() {
indicator.hide();
}
//
// create base UI tab and root window
//
var win0 = Titanium.UI.createWindow({
title:'Window 1',
backgroundColor:'#fff',
url:'test.js',
barColor:'#111'
});
win0.showAct= showAct;
win0.hideAct= hideAct;
var tab0 = Titanium.UI.createTab({
title:'Window 1',
window:win0
});
var win1 = Titanium.UI.createWindow({
title:'Window 2',
backgroundColor:'#fff',
url:'test.js',
barColor:'#111'
});
win1.showAct= showAct;
win1.hideAct= hideAct;
var tab1 = Titanium.UI.createTab({
title:'Window 1',
window:win1
});
if (isAndroid) {
var showIndicator = function(e) {
showAct();
};
win0.addEventListener('open', showIndicator);
win1.addEventListener('open', showIndicator);
}
//
// add tabs
//
tabGroup.addTab(tab0);
tabGroup.addTab(tab1);
tabGroup.open({
transition:Titanium.UI.iPhone.AnimationStyle.FLIP_FROM_LEFT
});
var win = Titanium.UI.currentWindow;
var data = [];
for (i = 0; i < 50; i++) {
//Ti.API.info("Muestra ----> " + iniciatives[i].title);
var row = Ti.UI.createTableViewRow({height:100});
var label = Ti.UI.createLabel({
text: 'title ' + i,
color: '#111',
textAlign:'left',
left:110,
font:{fontWeight:'bold',fontSize:14},
width:'auto',
height:'auto'
});
row.add(label);
var photo = Ti.UI.createImageView({
image: "http://www.appcelerator.com/wp-content/uploads/2009/06/titanium_desk.png",
top: 10,
left: 0,
width:105,
height:69
});
row.add(photo);
data[i] = row;
}
tableview = Titanium.UI.createTableView({
top:0, left:0, bottom:0, right:0, data: data, backgroundColor:'#fff'});
Titanium.UI.currentWindow.add(tableview);
win.hideAct();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment