Created
March 30, 2011 02:31
-
-
Save jonalter/893755 to your computer and use it in GitHub Desktop.
Creating Reusable Factories and Using Namespaces
This file contains 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
var myApp = {}; | |
Ti.include('ui.js'); | |
myApp.tabGroup = myApp.ui.createAppTabGroup(); | |
myApp.tabGroup.open(); |
This file contains 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() { | |
myApp.ui = {}; | |
myApp.ui.createTableWindow = function(_e) { | |
var win = Ti.UI.createWindow({ | |
title: _e.title, | |
backgroundColor: _e.backgroundColor | |
}); | |
return win; | |
}; | |
myApp.ui.createAppTabGroup = function() { | |
var tabGroup = Titanium.UI.createTabGroup(); | |
var tab1 = Titanium.UI.createTab({ | |
title: 'Blue', | |
window: myApp.ui.createTableWindow({ | |
title: 'Blue', | |
backgroundColor: 'blue' | |
}) | |
}); | |
var tab2 = Titanium.UI.createTab({ | |
title: 'Red', | |
window: myApp.ui.createTableWindow({ | |
title: 'Red', | |
backgroundColor:'red' | |
}) | |
}); | |
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