Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-14214] iOS: SplitWindow with showMasterInPortrait=true causes app to exit with Alloy

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionCannot Reproduce
Resolution Date2020-01-09T22:13:33.000+0000
Affected Version/sRelease 3.1.0
Fix Version/sn/a
ComponentsiOS
Labelsios, ipad, showMasterInPortrait, splitwindow, tabgroup
ReporterManoj Kumar
AssigneeUnknown
Created2013-05-14T09:48:39.000+0000
Updated2020-01-09T22:13:33.000+0000

Description

*Problem* The Alloy code below causes the app and simulator to exit when opening the SplitWindow. Removing showMasterInPortrait property from SplitWindow tag makes it work as usual. The property in the standard test case below works fine. *Steps to reproduce* 1. Drop the code below into a new Default Alloy Project 2. Run in iPad simulator 3. Observe app and simulator exit 4. Remove property, run again and it doesn't exit *index.xml*
 
<Alloy>
	<SplitWindow showMasterInPortrait="true" platform="ios" formFactor="tablet">
		<TabGroup>
			<Tab title="tab 1">
				<Window title="tab 1">
					<Label>tab 1</Label>
				</Window>
			</Tab>
			<Tab title="tab 2">
				<Window title="tab 2">
					<Label>tab 2</Label>
				</Window>
			</Tab>
		</TabGroup>
		<Window>
			<Label>This is the detail</Label>
		</Window>
	</SplitWindow>
</Alloy>
*index.js*
$.index.open();
*Standard test case (doesn't crash)*
var win = Ti.UI.createWindow();

var nav = Ti.UI.iPhone.createNavigationGroup({
   window: win
});

var masterView = Ti.UI.createWindow();

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

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

splitwin.open();
*Standard test case (crashes... Is Alloy calling tabGroup.open?)*
var win = Ti.UI.createWindow({
	backgroundColor : "#FFF"
});

var tabGroup = Titanium.UI.createTabGroup({
	id : 'tabGroup1'
});

var win1 = Ti.UI.createWindow();

var tab1 = Titanium.UI.createTab({
	icon : 'KS_nav_ui.png',
	window : win1
});

tabGroup.addTab(tab1);

var detailView = Ti.UI.createWindow();

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

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

tabGroup.open(); // simulator and app exits
splitwin.open();

Comments

  1. Daniel Sefton 2013-05-14

    Tested and confirmed in iOS 6 iPad simulator with Ti SDK 3.1 GA and 3.2 CI. I think it is caused by calling tabGroup.open(), which you can try yourself by running the bottom standard test case. @Manoj - Try replacing the master view with something else, you'll probably see that it doesn't crash @Tony - Do you think Alloy automatically calls tabGroup.open()?? Also worth noting that in the docs, the detailView is the one with the navigation group, not the master view: http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.UI.iPad.SplitWindow
  2. Manoj Kumar 2013-05-15

    When i use a window as master view instead of tabgroup it is working fine and no crashes. Even if i remove showMasterInPortrait="true" property and use tabgroup as master view no crashes. Only it happens when i use showMasterInPortrait="true" and tabgroup together. Now i avoid it by calling setShowMasterInPortrait method after the splitwindow is opened.

JSON Source