Skip to content

Instantly share code, notes, and snippets.

@jonalter
Created March 15, 2011 17:21
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonalter/871075 to your computer and use it in GitHub Desktop.
Save jonalter/871075 to your computer and use it in GitHub Desktop.
TiBountyHunter creating reusable factories
Titanium.UI.setBackgroundColor('#000');
var BHunter = {};
Ti.include('ui.js');
BHunter.tabGroup = BHunter.ui.createAppTabGroup();
BHunter.tabGroup.open();
(function() {
BHunter.ui = {};
BHunter.ui.createTableWindow = function(_e) {
var win = Ti.UI.createWindow({
title: _e.title
});
var data = [
{title: 'test 1'},
{title: 'test 2'},
{title: 'test 3'},
{title: 'test 4'},
{title: 'test 5'}
];
var tableView = Ti.UI.createTableView({
data: data
});
win.add(tableView);
return win;
};
BHunter.ui.createAppTabGroup = function() {
var tabGroup = Titanium.UI.createTabGroup();
var tab1 = Titanium.UI.createTab({
title: 'Fugitives',
window: BHunter.ui.createTableWindow({title: 'Fugitives'})
});
var tab2 = Titanium.UI.createTab({
title: 'Captured',
window: Titanium.UI.createWindow({
title: 'Captured',
backgroundColor:'#fff'
})
});
tabGroup.addTab(tab1);
tabGroup.addTab(tab2);
return tabGroup;
};
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment