Skip to content

Instantly share code, notes, and snippets.

@hal-gh
Created December 23, 2011 12:04
Show Gist options
  • Save hal-gh/1513998 to your computer and use it in GitHub Desktop.
Save hal-gh/1513998 to your computer and use it in GitHub Desktop.
Tab test
Ti.UI.setBackgroundColor('#000');
var tabGroup = Ti.UI.createTabGroup();
var win1 = Ti.UI.createWindow({
title:'Tab 1',
backgroundColor:'#fff'
});
var tab1 = Ti.UI.createTab({
title:'Tab 1',
window:win1
});
var label1 = Ti.UI.createLabel({
color:'#999',
text:'I am Window 1',
textAlign:'center',
width:'auto'
});
win1.add(label1);
var win2 = Ti.UI.createWindow({
title:'Tab 2',
backgroundColor:'#fff'
});
var tab2 = Ti.UI.createTab({
title:'Tab 2',
window:win2
});
var label2 = Ti.UI.createLabel({
color:'#999',
text:'I am Window 2',
textAlign:'center',
width:'auto'
});
win2.add(label2);
tabGroup.addTab(tab1);
tabGroup.addTab(tab2);
tabGroup.open();
tab1.addEventListener('click', function(e) {
Ti.API.info("tab1 clicked.");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment