{ "id": "111491", "key": "AC-1896", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "12217", "key": "AC", "name": "Appcelerator - INBOX", "projectCategory": { "id": "10000", "description": "", "name": "Customer Service" } }, "resolution": { "id": "5", "description": "All attempts at reproducing this issue failed, or not enough information was available to reproduce the issue. Reading the code produces no clues as to why this behavior would occur. If more information appears later, please reopen the issue.", "name": "Cannot Reproduce" }, "resolutiondate": "2013-03-22T16:43:54.000+0000", "created": "2013-03-21T14:58:30.000+0000", "labels": [ "views", "z-index" ], "versions": [], "issuelinks": [], "assignee": { "name": "mrahman", "key": "mrahman", "displayName": "Mostafizur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "updated": "2016-03-08T07:40:49.000+0000", "status": { "description": "A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.", "name": "Resolved", "id": "5", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "14548", "name": "Titanium SDK & CLI", "description": "Please enter tickets related to the MobileSDK here." } ], "description": "I have 5 views and set some arbitrary z-index on them as they're clicked. The ordering seems unpredictable but I think most of the time it's when the *second* view is clicked, the *third* view is supposed to show on top of the *fourth* view but instead the *fourth* view is on top of everything else, including the *second* view, which is supposed to be on top of all views.\r\n\r\n{code:title=app.js}\r\nvar v0 = Ti.UI.createView({\r\n\tborderColor : 'green',\r\n\tbackgroundColor : 'white',\r\n\theight : 200,\r\n\ttop : 0\r\n});\r\n\r\nvar v1 = Ti.UI.createView({\r\n\tborderColor : 'blue',\r\n\tbackgroundColor : 'white',\r\n\theight : 200,\r\n\ttop : 40\r\n});\r\n\r\nvar v2 = Ti.UI.createView({\r\n\tborderColor : 'red',\r\n\tbackgroundColor : 'white',\r\n\theight : 200,\r\n\ttop : 80\r\n});\r\n\r\nvar v3 = Ti.UI.createView({\r\n\tborderColor : 'purple',\r\n\tbackgroundColor : 'white',\r\n\theight : 200,\r\n\ttop : 120\r\n});\r\n\r\nvar v4 = Ti.UI.createView({\r\n\tborderColor : 'teal',\r\n\tbackgroundColor : 'white',\r\n\theight : 200,\r\n\ttop : 160\r\n});\r\n\r\nvar win = Ti.UI.createWindow({\r\n\tbackgroundColor : 'black'\r\n});\r\n\r\nvar views = [v0, v1, v2, v3, v4];\r\n\r\n// Add label to show order\r\nfor (var i = 0; i < 5; i++) {\r\n\tvar text = 'view ' + i + ' with z-index of null';\r\n\tvar topLabel = Ti.UI.createLabel({\r\n\t\ttext : text,\r\n\t\ttop : 0,\r\n\t\theight : 20\r\n\t});\r\n\tvar bottomLabel = Ti.UI.createLabel({\r\n\t\ttext : text,\r\n\t\tbottom : 0,\r\n\t\theight : 20\r\n\t});\r\n\tviews[i].add(topLabel);\r\n\tviews[i].add(bottomLabel);\r\n};\r\n\r\n// Change order by z-index\r\nchangeOrder = function(view, zs) {\r\n\tfor (var i = 0; i < 5; i++) {\r\n\t\tvar text = 'view ' + i + ' with z-index of ' + zs[i];\r\n\t\tviews[i].setZIndex(zs[i]);\r\n\t\tviews[i].children[0].setText(text);\r\n\t\tviews[i].children[1].setText(text);\r\n\t}\r\n};\r\n\r\nv0.addEventListener('click', function() {\r\n\tzs = [5, 4, 3, 0, 1];\r\n\tchangeOrder(v0, zs);\r\n});\r\n\r\nv1.addEventListener('click', function() {\r\n\tzs = [1, 5, 4, 3, 0];\r\n\tchangeOrder(v1, zs);\r\n});\r\n\r\nv2.addEventListener('click', function() {\r\n\tzs = [0, 1, 5, 4, 3];\r\n\tchangeOrder(v2, zs);\r\n});\r\n\r\nv3.addEventListener('click', function() {\r\n\tzs = [3, 0, 1, 5, 4];\r\n\tchangeOrder(v3, zs);\r\n});\r\n\r\nv4.addEventListener('click', function() {\r\n\tzs = [4, 3, 0, 1, 5];\r\n\tchangeOrder(v4, zs);\r\n});\r\n\r\nwin.add(v0);\r\nwin.add(v1);\r\nwin.add(v2);\r\nwin.add(v3);\r\nwin.add(v4);\r\nwin.open();\r\n{code}", "attachment": [], "flagged": false, "summary": "iOS: z-indexes of subsequently added views behave unpredictably when dynamically assigned", "creator": { "name": "kenhkan", "key": "kenhkan", "displayName": "Kenneth Kan", "active": true, "timeZone": "America/New_York" }, "subtasks": [], "reporter": { "name": "kenhkan", "key": "kenhkan", "displayName": "Kenneth Kan", "active": true, "timeZone": "America/New_York" }, "environment": "Ti mobile 3.0.22\r\nAlloy 1.0.0\r\niOS Simulator 6.1\r\nOS X 10.8", "comment": { "comments": [ { "id": "243693", "author": { "name": "dcassenti", "key": "dcassenti", "displayName": "Davide Cassenti", "active": true, "timeZone": "Europe/Berlin" }, "body": "Hello,\r\n\r\nThe index looks correct to me; when I click on v3 the order is (according to the code you posted): 3, 0, 1, 5, 4. In fact, I can see view 0 covering view 1 and view 2, but covered by view 3 and view 4. In particular, view 3 is over view 4 because its z-index is higher.\r\n\r\nAm I missing something?", "updateAuthor": { "name": "dcassenti", "key": "dcassenti", "displayName": "Davide Cassenti", "active": true, "timeZone": "Europe/Berlin" }, "created": "2013-03-22T16:43:54.000+0000", "updated": "2013-03-22T16:43:54.000+0000" }, { "id": "243735", "author": { "name": "kenhkan", "key": "kenhkan", "displayName": "Kenneth Kan", "active": true, "timeZone": "America/New_York" }, "body": "Hi Davide,\n\nMy bad. It's actually I who missed something. I realized that it might be the version of Ti SDK and it was. I was actually using Titanium SDK 3.1.0 and Titanium CLI 3.0.22, the latter of which I thought was the SDK version.\n\nI'm happy now as I'm using SDK 3.0.3. Is this still a valid bug for 3.1.0? Or is that version irrelevant now?\n\nThanks.", "updateAuthor": { "name": "kenhkan", "key": "kenhkan", "displayName": "Kenneth Kan", "active": true, "timeZone": "America/New_York" }, "created": "2013-03-22T19:39:57.000+0000", "updated": "2013-03-22T19:39:57.000+0000" }, { "id": "287256", "author": { "name": "mrahman", "key": "mrahman", "displayName": "Mostafizur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "body": "Hello,\r\n\r\nI tested this issue with the test code reporter has provided. I can't reproduce this issue in Ti SDK 3.2GA. Can you please retest your app with the latest TISDK. Please update ticket if you reproduce it.\r\n\r\nh5. Test Environments\r\nMac OS X 10.8.6\r\nTi SDK 3.2.0.GA\r\nTi CLI 3.2.0\r\nIOS simulator 7.0.3\r\n\r\n\r\nThanks \r\n", "updateAuthor": { "name": "shossain", "key": "shossain", "displayName": "Shak Hossain", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2014-01-08T20:04:07.000+0000", "updated": "2014-01-15T19:15:57.000+0000" } ], "maxResults": 4, "total": 4, "startAt": 0 } } }