Titanium JIRA Archive
Appcelerator Community (AC)

[AC-6220] iOS: 'masterIsOverlayed' covering up Detail View LeftNavButtons

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionDone
Resolution Date2019-06-26T08:38:50.000+0000
Affected Version/sn/a
Fix Version/sn/a
Componentsn/a
LabelsSplitWindow, iOS
ReporterAdam Armstrong
AssigneeShak Hossain
Created2019-04-19T18:31:39.000+0000
Updated2019-06-26T08:38:50.000+0000

Description

Attachments

FileDateSize
step1.png2019-04-19T18:33:26.000+000058803
step2.png2019-04-19T18:33:21.000+000056399
step3.png2019-04-19T18:33:17.000+000052810

Comments

  1. Vijay Singh 2019-04-19

    [~amwinsauto] As per doc [here](https://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.iOS.SplitWindow-property-masterViewVisible) " The property masterIsOverlayed controls how the master is displayed in portrait mode. When masterIsOverlayed is set to true, the detailView occupies the full screen and and masterView is displayed overlayed on top to the left of the screen. When masterIsOverlayed is set to false, the available screen width is split between the masterView and detailView. " is not it expected behavior? Or am I missing anything?
  2. Joshua Quick 2019-04-20

    I haven't tested this, but let me ask the question. If you launch the app in portrait form, are all of the navigation buttons shown? Is this only an issue when launching landscape? (If so, then this suggests that the UI layout isn't being updated for the new orientation.)
  3. Adam Armstrong 2019-04-22

    OK, I dont think I explained my issue correctly. When rotating the device then I expected the Master Overlay to change behavior based on Landscape/Portrait. So that is probably more on me to handle by adding an "orientationchange" event listener. Specifically, when in "Split Window" with another app. Meaning...your physical device may be in landscape....but if you are split 50%/50% with another app, then really my app should be operating as though it was Portrait. But, when trying to app my event listener, I am getting height=undefined and width=undefined. I tried to get height & width from the SplitWindow, the NavigationWindow and from the Window and all 3 return undefined. CODE
       Ti.Gesture.addEventListener('orientationchange',function(e) {
       	Ti.API.info('orientation changed!');
       	Ti.API.info('Orientation: ' + e.orientation);
       	Ti.API.info('Portrait: ' + e.source.portrait);
       	Ti.API.info('Landscape: ' + e.source.landscape);
       	Ti.API.info('Detail Win- Height: ' + $.detailWindow.height + ', Width: ' + $.detailWindow.width);
       	Ti.API.info('Detail NAV Win- Height: ' + $.detailNavWindow.height + ', Width: ' + $.detailNavWindow.width);
       	Ti.API.info('SplitWindow NAV Win- Height: ' + $.splitWindow.height + ', Width: ' + $.splitWindow.width);
       	if (e.source.portrait) {
       		$.masterCollapseButton.visible = true;
       		$.masterOpenButton.visible = true;
       	} else {
       		if ($.detailWindow.height >= $.detailWindow.width) {
       			//act as Portrait
       			$.masterCollapseButton.visible = true;
       			$.masterOpenButton.visible = true;
       		} else {
       			//landscape
       			$.masterCollapseButton.visible = false;
       			$.masterOpenButton.visible = false;
       			if (!$.splitWindow.masterViewVisible) { toggleMaster(); }	//when rotating to landscape, if master is hidden toggle it to be visible
       		}
       	}
       });
       
    CONSOLE [INFO] orientation changed! [INFO] Orientation: 2 [INFO] Portrait: true [INFO] Landscape: false [INFO] Detail Win- Height: undefined, Width: undefined [INFO] Detail NAV Win- Height: undefined, Width: undefined [INFO] SplitWindow NAV Win- Height: undefined, Width: undefined
  4. Adam Armstrong 2019-05-07

    Any idea how I can get the height and width of the Window within a SplitWindow?
  5. Rakhi Mitro 2019-05-24

    [~amwinsauto], Thanks for your query. Check this [link](https://stackoverflow.com/questions/46395850/titanium-how-to-determine-the-screen-width-when-using-splitview). Hope this helps.
  6. Adam Armstrong 2019-05-29

    I first started with the 'orientationchange' eventListener but that only works if you change orientation. What about if you open the app and go into Split Over but never rotate? So then I proceeded to use the 'postlayout' eventListener which works on any layout change - including rotating your device. So I removed the 'orientationchange' - since there was overlap there. But then I was left with still the biggest issue: There is no way to know/identify when the iPad is in SplitOver with another app. Thats when I decided to take the device height/width into account to solve the problem. This works perfect - should anyone need it.
       var showMaster = true;
       Alloy.Globals.deviceSmallestMeasurement = (parseInt(Ti.Platform.displayCaps.platformWidth) < parseInt(Ti.Platform.displayCaps.platformHeight)) ? parseInt(Ti.Platform.displayCaps.platformWidth) : parseInt(Ti.Platform.displayCaps.platformHeight);
       
       function toggleMaster(){
       	$.splitWindow.masterViewVisible = !showMaster;
       	showMaster = !showMaster;
       }
       
       $.splitWindow.addEventListener('postlayout',function(e) {	
       		if ($.splitWindow.toImage().width <= Alloy.Globals.deviceSmallestMeasurement) {
       			//act as Portrait
       			$.masterCollapseButton.visible = true;
       			$.masterOpenButton.visible = true;
       		} else {
       			//landscape
       			$.masterCollapseButton.visible = false;
       			$.masterOpenButton.visible = false;
       			if (!$.splitWindow.masterViewVisible) { toggleMaster(); }	//when rotating to landscape, if master is hidden toggle it to be visible
       		}
       });
       

JSON Source