Feature description
With the new iOS 7 the new "navigationWindow" API has been introduced for handling the navigation logic for iOS 7.
Using a classic Titanium project, the sample code would be:
var rootWin = Ti.UI.createWindow({
backgroundColor:"white"
});
var navWin = Ti.UI.iOS.createNavigationWindow({
window:rootWin
});
var secondWin = Ti.UI.createWindow({
backgroundColor:"blue"
});
var b1 = Ti.UI.createButton({
title:"PUSH"
});
rootWin.add(b1);
var b2 = Ti.UI.createButton({
title:"POP"
});
secondWin.add(b2);
b1.addEventListener('click',function(){
navWin.push(secondWin)
});
b2.addEventListener('click',function(){
navWin.pop(secondWin)
});
navWin.open();
Details
navigationWindow is supposed to be the top-level container (is a Window proxy, not a View).
Is going to work as alternative Ti.UI.iPhone.NavigationGroup (which is going to be deprecated)
Should also work if used in Ti.UI.iPad.SplitWindow.
Notes
I think the expected behavior is to be able to use it pretty much in this way:
<Alloy>
<NavigationWindow id='navigation'>
<Window id='mainWin'>
<other stuff...>
</Window>
</NavigationWindow>
</Alloy>
Then I guess that windows could be added or removed from the navigationWindow using something like:
var newWin = Alloy.createController('newWin').getView();
$.navigation.push(newWin);
and
$.navigation.pop(newWin);
Additional info
Attached you can find also an Alloy sample code using the navigationWindow element defined in the index controller instead of in the .xml markup
PR (master): https://github.com/appcelerator/alloy/pull/237 commit (1_2_X): https://github.com/appcelerator/alloy/commit/3f6c1e0372a1276904bf61d80066e7e28584324a test app: https://github.com/appcelerator/alloy/tree/master/test/apps/ui/navwindow Functional test for both branches:
Run the test app on ios
Ensure that it loads without error
Click the "push" button to push another window onto the stack
On the resulting window, click the "push" button in the nav bar to push another window onto the stack
Click the "pop" button in the nav bar on the resulting window to remove the current window from the stack
Try multiple pushes and/or pops and ensure that the navigation behaves as expected