Created
December 8, 2011 12:24
-
-
Save lucipacurar/1446841 to your computer and use it in GitHub Desktop.
Trying to get a tabgroup based app working
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
require('modules/monkeypatch').monkeypatch(this); | |
(function() { | |
Titanium.UI.setBackgroundColor('#fff'); | |
require('modules/core').loadTabGroup('LoginTabGroup'); | |
})(); |
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 activeTabGroup = null; | |
/** | |
* Loads a tab group | |
* @param {String} name Name of tabGroup | |
* @param {Object} params Additional parameters | |
*/ | |
exports.loadTabGroup = function(name, params) { | |
activeTabGroup = require('modules/ui/' + name); | |
activeTabGroup.load(exports, params); | |
}; | |
/** | |
* Returns the active tabGroup module | |
* @return {Object} active tabGroup | |
*/ | |
exports.activeTabGroup = function() { | |
return activeTabGroup; | |
}; | |
/** | |
* Returns the active tab of the active tabGroup module | |
* @return {Object} active tab | |
*/ | |
exports.activeTab = function() { | |
return activeTabGroup.activeTab(); | |
}; |
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
/** | |
* Loads the Login tab | |
* @param {Object} instance of the core module | |
* @param {Object} params Additional parameters | |
*/ | |
exports.load = function(app, params) { | |
var tab = Ti.UI.createTab({ | |
title: 'Title' | |
}); | |
app.activeTabGroup().add(tab); | |
app.activeTabGroup().activeTab(tab); | |
require('modules/ui/Window').load(app, params); | |
}; |
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 tabGroup = Ti.UI.createTabGroup(); | |
/** | |
* Loads the Login tabGroup | |
* @param {Object} instance of the core module | |
* @param {Object} params Additional parameters | |
*/ | |
exports.load = function(app, params) { | |
require('modules/ui/Tab').load(app, params); | |
tabGroup.open(); | |
}; | |
/** | |
* Returns the active tab of the Login tabGroup | |
* @return {Object} active tab | |
*/ | |
exports.activeTab = function(tab) { | |
if (tab) { | |
tabGroup.setActiveTab(tab); | |
} else { | |
return tabGroup.activeTab; | |
} | |
}; | |
/** | |
* Adds a tab to the Login tabGroup | |
* @param {Object} tab | |
*/ | |
exports.add = function(tab) { | |
tabGroup.add(tab); | |
}; |
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
** | |
* Loads the Login Window | |
* @param {Object} instance of the core module | |
* @param {Object} params Additional parameters | |
*/ | |
exports.load = function(app, params) { | |
var win = Ti.UI.createWindow({ | |
title: "Window", | |
tabBarHidden: true | |
}); | |
app.activeTabGroup().activeTab().add(loginWin); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment