Let's assume I have 3 files Window1.js
, Window2.js
and Window3.js
.
I can navigate from Window1
to Window2
and from Window2
to Window3
with no problem.
When I want to come back from window3 to window2 I do: window3.close();
Now I'm on window2 and want to go back to window1, so I did: window2.close();
. But instead that got my back to window3 not to window1 as I wanted. Is there any way to get back to window1? Can someone explain me how to navigate between this windows in titanium?Thanks
have a look at this: the wiki provides a cool video with example code. maybe you can provide some could to validate your problem..
the example itself is very nice since it works great for an arbitary amount of windows. it provides a stack:
this.windowStack = [];
that is going to be filset window.navbarHidden = true or led with the current window and the window will be opened within a navgroup. this provides the iphone navigation bar at the top (with backbutton etc)
this.windowStack.push(windowToOpen);
this.navGroup.open(windowToOpen);
the example also provides the possibility to get the first window, your window1. for that the stack will be flushed
for(var i = 1, l = windows.length; i < l; i++) {
(this.navGroup) ? this.navGroup.close(windows[i]) : windows[i].close();
}
[update]
if you are not interested in the navbar just set
window1.navbarHidden = true
alternativly you can edit the navigation controller like this:
exports.NavigationController.prototype.open = function(/*Ti.UI.Window*/windowToOpen) {
//add the window to the stack of windows managed by the controller
this.windowStack.push(windowToOpen);
//grab a copy of the current nav controller for use in the callback
var that = this;
windowToOpen.addEventListener('close', function() {
that.windowStack.pop();
});
//This is the first window
if(this.windowStack.length === 1 && (Ti.Platform.osname === 'android')) {
windowToOpen.exitOnClose = true;
}
// open
windowToOpen.open();
};