Titanium JIRA Archive
Alloy (ALOY)

[ALOY-815] iOS 7: add 'navigationWindow' API to XML markup

GitHub Issuen/a
TypeNew Feature
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2013-10-28T21:55:06.000+0000
Affected Version/sn/a
Fix Version/sAlloy 1.3.0, Alloy 1.2.2, 2013 Sprint 18
ComponentsRuntime, XML
Labelsqe-testadded
ReporterFederico Casali
AssigneeTony Lukasavage
Created2013-09-03T19:13:49.000+0000
Updated2013-10-28T21:55:11.000+0000

Description

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

Attachments

FileDateSize
alloy_navigationWindowSample.zip2013-09-03T19:15:07.000+00003836715

Comments

  1. Tony Lukasavage 2013-09-04

    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

JSON Source