Skip to content

Instantly share code, notes, and snippets.

@lucipacurar
Created December 8, 2011 12:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save lucipacurar/1446841 to your computer and use it in GitHub Desktop.
Save lucipacurar/1446841 to your computer and use it in GitHub Desktop.
Trying to get a tabgroup based app working
require('modules/monkeypatch').monkeypatch(this);
(function() {
Titanium.UI.setBackgroundColor('#fff');
require('modules/core').loadTabGroup('LoginTabGroup');
})();
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();
};
/**
* 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);
};
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);
};
**
* 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