use addTab()
instead of add()
because you are adding tab to tabGroup. Tabs are added to tabGroup using addTab()
method.
tabGroup.addTab(CWtab);
tabGroup.addTab(GItab);
tabGroup.addTab(TWtab);
tabGroup.addTab(GItab2);
Question
I'm trying to get images displayed in a tab group, but for the life of me it's not working, even with system images.
Here's the code:
var tabGroup = Titanium.UI.createTabGroup();
var TWtab = Titanium.UI.createTab({
window:ToursWin,
title:'Tours',
icon:"/images/btn_pause.png"
});
var CWtab = Titanium.UI.createTab({
window:currencyWin,
title:'Currency',
icon:"images/button_back.png"
});
var GItab = Titanium.UI.createTab({
window:GenInfoWin,
title:'General Info',
icon:"../images/btn_pause.png"
});
var GItab2 = Titanium.UI.createTab({
window:GenInfoWin,
title:'General Info',
icon:Ti.UI.iPhone.SystemIcon.CONTACTS
});
tabGroup.add(CWtab);
tabGroup.add(GItab);
tabGroup.add(TWtab);
tabGroup.add(GItab2);
//win.add(tabGroup);
tabGroup.open();
And here's the result:
So the tabgroup is there, but no images are shown.
The paths have different combinations in hope that something will work, i'm even using system images, but nothing!
What is wrong with it?
Solution
use addTab()
instead of add()
because you are adding tab to tabGroup. Tabs are added to tabGroup using addTab()
method.
tabGroup.addTab(CWtab);
tabGroup.addTab(GItab);
tabGroup.addTab(TWtab);
tabGroup.addTab(GItab2);