switch between tab groups
I am new to titanium but know a bit of java so learning fast but struggling to figure out how to switch between tab groups.
You have probably seen this on many apps before where you have 4 tabs say and one of the tabs is [more tabs option] and switch you from one group tabs to another and back.
Dose anyone here have any idea hoe to achieve this i thought addeventlistener but did work for me and the docs a very vage.
would appreciate the help thanks
2 Answers
-
var addTabButton = Titanium.UI.createButton({
title:'Add/Remove Tab',
top:10,
height:40,
width:200
});// create button event listener
addTabButton.addEventListener('click', function(e)
{
if (tabGroup.tabs.length == 5)
{
var win = Ti.UI.createWindow({title:'New Tab Window',barColor:'#000'});
var newtab = Titanium.UI.createTab({
icon:'../images/tabs/KS_nav_mashup.png',
title:'New Tab',
win:win
});
tabGroup.addTab(newtab);
}
else
{
var newtab = tabGroup.tabs[5];
tabGroup.removeTab(newtab);
}
}); -
Solved it
If anyone knows a better why please leave your solution posted :)
tab4.addEventListener('focus',function(e) { tabGroup.close(); tabGroup2.open(); }); tab8.addEventListener('focus',function(e) { tabGroup2.close(); tabGroup.open(); });