Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-9995] iOS: Z-Index of Windows is ignored.

GitHub Issuen/a
TypeBug
PriorityMedium
StatusReopened
ResolutionUnresolved
Affected Version/sRelease 2.1.0
Fix Version/sn/a
ComponentsiOS
Labelscore
ReporterJoel Koett
AssigneeNeeraj Gupta
Created2012-07-07T11:17:06.000+0000
Updated2017-03-23T21:55:07.000+0000

Description

If I create window a with z-index 1, and then I create window b with z-index 0, window b is still in front of window a). While coding windows which require the original window to stay stationary (such as coding window a to "slide-over" window b), I can't make this work because window b appears in front of window a (even if I set the z-index). The layering of the windows, it seems, it only defined by the order in which they were created (ignoring z-index). The only solution I have found, is to destroy window a, and re-create it, ensuring that it will be placed above window b. Thanks for your help :), -- Joel.

Comments

  1. Joel Koett 2012-07-07

    I believe this is also an issue with all components (views too).
  2. Joel Koett 2012-07-07

    For those who are interested, a work-around (not solution) to this issue, is to "push" window b down with window a, circumventing the need for z-index, since window b never needs to be position over window a. But this requires a reference to window a, when animating window b.
  3. Betty Tran 2012-07-17

    Code to reproduce
       var win1 = Ti.UI.createWindow({
       	backgroundColor: 'pink',
       	zIndex: 2
       });
       
       win1.open();
       
       var win2 = Ti.UI.createWindow({
       	backgroundColor: 'orange',
       	zIndex: 1
       });
       
       win2.open();
       
       
       
  4. Sabil Rahim 2012-07-18

    This is an invalid ticket. zIndex will only used to windows that being placed on the same view hierarchy and not on independently opened windows. The following code is how it should actually be added and it works.
       var win = Ti.UI.createWindow({
           backgroundColor: 'green',
       });
       
       var win1 = Ti.UI.createWindow({
           backgroundColor: 'red',
       	height:120,
       	width:120,
       	top:50,
       	right:30,
           zIndex: 2
       });
        
       var win2 = Ti.UI.createWindow({
           backgroundColor: 'blue',
           height:120,
       	width:120,
       	top:100,
       	right:60,
       	zIndex: 11
       });
       win.add(win1);
       win.add(win2);
       win.open();
       
       
    Marking ticket as invalid
  5. Sabil Rahim 2012-07-18

    Linking ticket to the overall bug scrub
  6. Joel Koett 2012-07-19

    So then is there no way to layer independently opened windows other than in the order that they are opened?
  7. Jan Helleman 2013-01-07

    Dear Sabil Rahim, I think you guys should really consider adding this to the documentation. I have been looking for a way to open a window behind another one for ages, without making the app flash a black background (open back first invisible, then front). If I knew this, it would have saved me hours of time.
  8. Lee Morris 2017-03-22

    Closing ticket as invalid with reference to the above comments.
  9. Joel Koett 2017-03-22

    So then is there no way to layer independently opened windows other than in the order that they are opened?
  10. Joel Koett 2017-03-22

    @lmorris

JSON Source