Titanium JIRA Archive
Alloy (ALOY)

[ALOY-818] iOS7: NavigationWindow should work also inside Ti.UI.iPad.SplitWindow

GitHub Issuen/a
TypeImprovement
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2013-09-04T23:35:46.000+0000
Affected Version/sAlloy 1.3.0, Alloy 1.2.1
Fix Version/sAlloy 1.3.0, Alloy 1.2.2, 2013 Sprint 18
ComponentsTitanium SDK, XML
Labelsn/a
ReporterFederico Casali
AssigneeTony Lukasavage
Created2013-09-04T18:40:05.000+0000
Updated2013-09-06T20:57:46.000+0000

Description

Description

iOS Ui object should also be used inside a object for iPad.

Sample

In classic Titanium projects, this is showing two NavigationWindows inside a SplitView object (one as master view, the other as detail view)
var win1 = Ti.UI.createWindow({
	backgroundColor:'gray'
});

var label1 = Ti.UI.createLabel({
	text:'detail view',
	color:'orange',
	font:{
		fontSize:'24dp'
	},
	fontWeight:'bold'
});

win1.add(label1);


var win2 = Ti.UI.createWindow({
	backgroundColor:'purple'
});

var label2 = Ti.UI.createLabel({
	text:'master view',
	color:'orange',
	font:{
		fontSize:'24dp'
	},
	fontWeight:'bold'
});

win2.add(label2);



var nav = Ti.UI.iOS.createNavigationWindow({
   window: win1
});

var masterView = Ti.UI.iOS.createNavigationWindow({
   window: win2
});

var splitwin = Ti.UI.iPad.createSplitWindow({
    detailView: nav,
    masterView: masterView
});

splitwin.addEventListener('visible',function(e){
    if (e.view == 'detail'){
        e.button.title = "Master";
        win1.leftNavButton = e.button;
    } else if (e.view == 'master'){
        win1.leftNavButton = null;
    }
});

splitwin.open();

Alloy sample

On Alloy, this sample code is throwing the following exception when run:
[ERROR] :  SplitWindow must have exactly 2 children that are Windows, a master and detail respectively
[ERROR] :  Alloy compiler failed
index.xml
<Alloy>
    <SplitWindow>
        <!-- First window is the masterView -->
        <NavigationWindow platform="ios">
        	<Window id="main" title="Main Window">
        	    <Label class="space">I am the master view</Label>
        	</Window>
   		 </NavigationWindow>

        <!-- Second window is the detailView -->
        <NavigationWindow platform='ios'>
        	<Window>
            	    <Label>I am the detail view.</Label>
       		</Window>
        </NavigationWindow>
    </SplitWindow>
</Alloy>

Comments

  1. Tony Lukasavage 2013-09-04

    PR (master): https://github.com/appcelerator/alloy/pull/240 commit (1_2_X): https://github.com/appcelerator/alloy/commit/c57e5ad31a4651b6f4e9b7c444023c5d79ea44b9 test apps:

    https://github.com/appcelerator/alloy/tree/master/test/apps/ui/splitwindow

    https://github.com/appcelerator/alloy/tree/master/test/apps/testing/ALOY-818

    functional testing (iPad only):

    ui/splitwindow

    Run the app for ipad and ensure it functions as it always has. This is simply to ensure no regressions in the simplest cases

    Change the in the index.xml to a

    Attempt to run again and ensure that you get error that looks something like this:

       [ERROR] Ti.UI.iPad.SplitWindow (line 13)  invalid child type "Ti.UI.Label"
       [ERROR] Ti.UI.iPad.SplitWindow must have exactly 2 children of one of the following types:
       [ERROR]   [Ti.UI.Window,Ti.UI.TabGroup,Ti.UI.iOS.NavigationWindow]
       [ERROR] The first child is the master, the second is the child.
       [ERROR] Alloy compiler failed
       

    Change the

    Add a 3rd under the

    Attempt to run again and ensure that you get an error that looks something like this:

       [ERROR] Ti.UI.iPad.SplitWindow (line 13)  has 3 child elements
       [ERROR] Ti.UI.iPad.SplitWindow must have exactly 2 children of one of the following types:
       [ERROR]   [Ti.UI.Window,Ti.UI.TabGroup,Ti.UI.iOS.NavigationWindow]
       [ERROR] The first child is the master, the second is the child.
       [ERROR] Alloy compiler failed
       

    testing/ALOY-818

    Run the app on ipad

    Ensure that it compiles and runs without error, showing both the master and detail windows (when in landscape orientation)

JSON Source