Reputation: 19418
I have a tabGroup and it holds 3 tabs.
Code in app.js:
// create tab group
var tabGroup = Titanium.UI.createTabGroup(
{
//tabBarHidden:false
});
var win1 = Titanium.UI.createWindow({
url:'TabClasses/Tab1/Tab1.js',
navBarHidden:true
});
var tab1 = Titanium.UI.createTab({
icon:'KS_nav_views.png',
title:'Friend List',
window:win1
});
var win2 = Titanium.UI.createWindow({
url:'TabClasses/Tab2/SearchView.js'
});
var tab2 = Titanium.UI.createTab({
icon:'KS_nav_ui.png',
title:'Search',
window:win2
});
var win3 = Titanium.UI.createWindow({
url:'TabClasses/Tab2/FindView.js'
});
var tab3 = Titanium.UI.createTab({
icon:'KS_nav_ui.png',
title:'Places',
window:win3
});
// add tabs
tabGroup.addTab(tab1);
tabGroup.addTab(tab2);
tabGroup.addTab(tab3);
loginBtn.addEventListener('click',function(e)
{
if (true)
{
tabGroup.open
({
transition: Titanium.UI.iPhone && Titanium.UI.iPhone.AnimationStyle.FLIP_FROM_LEFT
});
}
});
But when I click on different tabs , the tabs changes only once. Means when I click on tab 2 from tab 1 it changes but when I go back to tab 1 then it does not change and remains tab 2 's screen.
How can I solve this issue ?
Also it works Fine in Android !!!
Thanks...
Upvotes: 0
Views: 1566
Reputation: 8856
Don't create and open a new window in your .js file. You should use current window like
var currentWindow = Titanium.UI.currentWindow
Upvotes: 1
Reputation: 19418
Solved :
There was a mistake in my code. I was creating new window in every .js (Tab1.js, Tab2.js and Tab3.js) file. Like :
var currentWindow = Titanium.UI.createWindow;
({
title:'A List',
backgroundColor:'white',
top:0,
height:416
});
instead of
var currentWindow = Titanium.UI.currentWindow;
Upvotes: 0