{ "id": "118811", "key": "TIMOB-14923", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [], "resolution": null, "resolutiondate": null, "created": "2013-08-20T16:14:41.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [ "defect", "ios" ], "versions": [ { "id": "14613", "description": "Release 2.1.4", "name": "Release 2.1.4", "archived": true, "released": true, "releaseDate": "2012-11-12" }, { "id": "14164", "description": "Release 3.0.2", "name": "Release 3.0.2", "archived": true, "released": true, "releaseDate": "2013-02-19" }, { "id": "15478", "description": "Release 3.1.1", "name": "Release 3.1.1", "archived": true, "released": true, "releaseDate": "2013-06-17" }, { "id": "15479", "description": "Release 3.1.2", "name": "Release 3.1.2", "archived": true, "released": true, "releaseDate": "2013-07-31" } ], "issuelinks": [], "assignee": null, "updated": "2018-02-28T20:03:41.000+0000", "status": { "description": "The issue is open and ready for the assignee to start work on it.", "name": "Open", "id": "1", "statusCategory": { "id": 2, "key": "new", "colorName": "blue-gray", "name": "To Do" } }, "components": [ { "id": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "*Problem*\r\nI cannot get values for rect or getRect on a view. I try to see the values after adding to the window and after a postlayout event (per the docs). Both return an empty object.\r\n\r\n*Test case*\r\n{code:javascript}\r\nvar win = Ti.UI.createWindow({\r\n\tbackgroundColor: 'white'\r\n});\r\n\r\nvar v1 = Ti.UI.createView({\r\n\theight: 104,\r\n\twidth: Ti.UI.FILL,\r\n\ttop: 30,\r\n\tbackgroundColor: '#f2f2ff'\r\n});\r\n\r\nvar l1 = Ti.UI.createLabel({\r\n\ttext: 'I am a label',\r\n\theight: Ti.UI.SIZE,\r\n\ttop: 20,\r\n\tleft: 97,\r\n\tright: 1,\r\n\ttextAlign: 'center',\r\n\tcolor: 'black',\r\n\tfont: {\r\n\t\tfontSize: 18,\r\n\t\tfontWeight: 'bold'\r\n\t},\r\n\tminimumFontSize: 14\r\n});\r\n\r\nfunction v1post() {\r\n\tTi.API.info('v1 rect (postlayout): ' + JSON.stringify(this.getRect()));\r\n\tv1.removeEventListener('postlayout', v1post);\r\n}\r\n\r\nv1.addEventListener('postlayout', v1post);\r\n\r\nv1.add(l1);\r\nwin.add(v1);\r\n\r\nTi.API.info('v1 rect: ' + JSON.stringify(v1.getRect()));\r\n\r\nwin.open();\r\n{code}\r\n\r\n*Output*\r\n{code}[INFO] : v1 rect: {}\r\n[INFO] : v1 rect (postlayout): {}{code}", "attachment": [], "flagged": false, "summary": "iOS: rect and getRect values returning empty object", "creator": { "name": "mross@qtags.com", "key": "mross@qtags.com", "displayName": "Mark Ross", "active": true, "timeZone": "America/Chicago" }, "subtasks": [], "reporter": { "name": "mross@qtags.com", "key": "mross@qtags.com", "displayName": "Mark Ross", "active": true, "timeZone": "America/Chicago" }, "environment": "Ti SDK 3.1.2.GA\r\nStudio 3.1.2\r\nSimulator 6.1\r\niPhone 4S 6.1.3", "comment": { "comments": [ { "id": "267347", "author": { "name": "jbuckley", "key": "jbuckley", "displayName": "Jamie Buckley", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Tested with SDK versions 2.1.4, 3.0.2, 3.1.1, 3.1.2 reproduced error on each.", "updateAuthor": { "name": "jbuckley", "key": "jbuckley", "displayName": "Jamie Buckley", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-08-20T18:11:43.000+0000", "updated": "2013-08-20T18:11:43.000+0000" }, { "id": "269288", "author": { "name": "pts", "key": "pts", "displayName": "Tayler Summers", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Just a note: the getRect() return value is not JSON.stringifiable, but you should still be able to look at the return value's properties individually. Try replacing your ln. 28 with something like this:\r\n\r\n{{var v1Rect = this.getRect();}}\r\n\r\n{{Ti.API.info('v1Rect x: ' + v1Rect.x);}}\r\n{{Ti.API.info('v1Rect y: ' + v1Rect.y);}}\r\n{{Ti.API.info('v1Rect height: ' + v1Rect.height);}}\r\n{{Ti.API.info('v1Rect width: ' + v1Rect.width);}}\r\n\r\nWhile you can't see all the values at once stringified, this at least shows that those values exist and that you can use them.\r\n", "updateAuthor": { "name": "pts", "key": "pts", "displayName": "Tayler Summers", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-09-03T16:38:31.000+0000", "updated": "2013-09-03T16:38:31.000+0000" } ], "maxResults": 2, "total": 2, "startAt": 0 } } }