I realize this is the most basic of questions, but I am unable to find out how to link between windows without using tabs.
The following code works to close a window, which sort of works as a back button. But how do I specify which file/url I would like to link to?
btn_home.addEventListener("click", function() {
Ti.UI.currentWindow.close();
});
I found a solution:
btn_home.addEventListener('click', function() {
var newWindow = Titanium.UI.createWindow({ url: 'home.js' });
newWindow.open(newWindow,{animated:true});
});
There is a few ways you can do this.
App flow for samples:
- app.js opens page1.js
- page1.js opens page2.js ( just like the code you have above )
Approaches:
- Add a button to the navbar, toolbar or customized view that acts like a "back" button and closes page2.js
- Create a window manager through events. This usually sits in the app.js and manages what windows are opened and closed.
- Use TabGroups, but hide the TabBar when the window is open by setting tabBarHidden:true. You'll have to do this when opening all windows though.
If you're only building on iOS I'd recommend #3 as it is easiest. If you are also doing Android #2 would provide the greatest amount of flexibility as it allows you to better style the page "header".