Created
March 15, 2011 17:21
-
-
Save jonalter/871075 to your computer and use it in GitHub Desktop.
TiBountyHunter creating reusable factories
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Titanium.UI.setBackgroundColor('#000'); | |
var BHunter = {}; | |
Ti.include('ui.js'); | |
BHunter.tabGroup = BHunter.ui.createAppTabGroup(); | |
BHunter.tabGroup.open(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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