{ "id": "91012", "key": "TIMOB-8941", "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": [ { "id": "13271", "description": "Release 2.1.0", "name": "Release 2.1.0", "archived": false, "released": true, "releaseDate": "2012-06-29" }, { "id": "13404", "description": "Sprint 2012-12 Core", "name": "Sprint 2012-12 Core", "archived": true, "released": true, "releaseDate": "2012-06-17" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2012-06-13T14:01:56.000+0000", "created": "2012-04-29T17:45:40.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "SupportTeam", "core", "module_scrollview", "qe-testadded" ], "versions": [ { "id": "13272", "description": "Release 2.0.1", "name": "Release 2.0.1", "archived": true, "released": true, "releaseDate": "2012-04-16" } ], "issuelinks": [], "assignee": { "name": "mstepanov", "key": "mstepanov", "displayName": "Max Stepanov", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2012-07-09T10:07:23.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "h6.Issue\r\nScrollView Children do not size properly. Label 6 doesn't calculate size properly (uses remaining visible space), but Label 7 and Label 1-5 all calculate size properly.\r\n\r\nh6.Tested on\r\niOS 5 simulator \r\n\r\nh6.Expected behavior\r\nChildren should calculate based on contentWidth. Example will run under 1.8.2. When run under 1.8.2 sizes are as expected.\r\n\r\nh6.Current behavior\r\nInstead, children use visible width value to calculate their size. As seen in screenShot with Titanium SDK 2.0.1.GA2\r\n\r\nh6.Repro sequence\r\n{code}\r\nvar view = Ti.UI.createScrollView({\r\n borderWidth: 1,\r\n borderColor: '#f00',\r\n layout:'horizontal',\r\n height: 35,\r\n contentHeight: 35,\r\n contentWidth: 'auto',\r\n left: 0,\r\n right: 0\r\n});\r\n\r\nvar items = ['Label 1', 'Label 2', 'Label 3', 'Label 4', 'Label 5', 'Label 6', 'Label 7'];\r\n\r\nitems.forEach(function(item) {\r\n \r\n var width = (Ti.UI.SIZE == undefined) ? 'auto': Ti.UI.SIZE; //So example works under 1.8.2 or 2.0.1\r\n \r\n var tLabel = Ti.UI.createLabel({\r\n touchEnabled: false,\r\n text:' ' + item + ' ', //To add inner padding\r\n backgroundColor: '#6CF',\r\n borderColor: '#000',\r\n borderWidth: 1,\r\n borderRadius: 5,\r\n color: '#FF0080',\r\n right: 5,\r\n top: 1,\r\n width:width,\r\n height:22,\r\n font: {\r\n fontSize: 13\r\n },\r\n textAlign: 'center'\r\n });\r\n view.add(tLabel);\r\n});\r\n\r\nvar rootWin = Ti.UI.createWindow({\r\n backgroundColor: '#ccc'\r\n});\r\n\r\n// add table view to the window\r\nrootWin.add(view);\r\nrootWin.open();\r\n{code}\r\n\r\nh6.API Docs\r\nhttp://docs.appcelerator.com/titanium/2.0/index.html#!/api/Titanium.UI.ScrollView-property-contentWidth", "attachment": [ { "id": "27448", "filename": "app.js", "author": { "name": "meeech", "key": "meeech", "displayName": "Mitchell Amihod", "active": true, "timeZone": "America/New_York" }, "created": "2012-04-29T17:46:11.000+0000", "size": 1263, "mimeType": "application/x-javascript" }, { "id": "27449", "filename": "right-1.8.2.png", "author": { "name": "meeech", "key": "meeech", "displayName": "Mitchell Amihod", "active": true, "timeZone": "America/New_York" }, "created": "2012-04-29T17:48:43.000+0000", "size": 120188, "mimeType": "image/png" }, { "id": "27450", "filename": "wrong-2.0.1.png", "author": { "name": "meeech", "key": "meeech", "displayName": "Mitchell Amihod", "active": true, "timeZone": "America/New_York" }, "created": "2012-04-29T17:48:43.000+0000", "size": 120555, "mimeType": "image/png" } ], "flagged": false, "summary": "iOS: Children views inside scrollview aren't calculating size properly", "creator": { "name": "meeech", "key": "meeech", "displayName": "Mitchell Amihod", "active": true, "timeZone": "America/New_York" }, "subtasks": [], "reporter": { "name": "meeech", "key": "meeech", "displayName": "Mitchell Amihod", "active": true, "timeZone": "America/New_York" }, "environment": "iOS 5\r\nTitanium SDK 1.8.2 & 2.0.1.GA2", "comment": { "comments": [ { "id": "196381", "author": { "name": "mstepanov", "key": "mstepanov", "displayName": "Max Stepanov", "active": true, "timeZone": "America/Los_Angeles" }, "body": "*Related issue:*\r\nFor some reason NSString's - (CGSize)sizeWithFont:(UIFont *)font constrainedToSize:(CGSize)size lineBreakMode:(UILineBreakMode)lineBreakMode method truncates the string having trailing spaces when given _size_ parameter width is equal to the expected return width.\r\nE.g. for size=(61,20) it returns (60, 16), but for size=(60,20) it returns (56, 16).\r\nif there is no space, the returned values are same.", "updateAuthor": { "name": "mstepanov", "key": "mstepanov", "displayName": "Max Stepanov", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-05-29T16:21:11.000+0000", "updated": "2012-05-29T16:21:11.000+0000" }, { "id": "196383", "author": { "name": "mstepanov", "key": "mstepanov", "displayName": "Max Stepanov", "active": true, "timeZone": "America/Los_Angeles" }, "body": "*Possible fix:*\r\n{code}\r\ndiff --git a/iphone/Classes/TiUIScrollViewProxy.m b/iphone/Classes/TiUIScrollViewProxy.m\r\nindex d6fd66d..35d59ff 100644\r\n--- a/iphone/Classes/TiUIScrollViewProxy.m\r\n+++ b/iphone/Classes/TiUIScrollViewProxy.m\r\n@@ -188,7 +188,7 @@\r\n }\r\n else if (TiDimensionIsAutoSize(constraint))\r\n {\r\n- bounds.size.width = [child autoWidthForSize:CGSizeMake(boundingValue,bounds.size.height - offset2)] + offset;\r\n+ bounds.size.width = [child autoWidthForSize:CGSizeMake(-1,bounds.size.height - offset2)] + offset;\r\n horizontalLayoutBoundary += bounds.size.width;\r\n }\r\n else if (TiDimensionIsAuto(constraint) )\r\n{code}", "updateAuthor": { "name": "mstepanov", "key": "mstepanov", "displayName": "Max Stepanov", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-05-29T16:24:10.000+0000", "updated": "2012-05-29T16:24:10.000+0000" }, { "id": "197572", "author": { "name": "mstepanov", "key": "mstepanov", "displayName": "Max Stepanov", "active": true, "timeZone": "America/Los_Angeles" }, "body": "PR pending https://github.com/appcelerator/titanium_mobile/pull/2338", "updateAuthor": { "name": "mstepanov", "key": "mstepanov", "displayName": "Max Stepanov", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-06-06T14:24:37.000+0000", "updated": "2012-06-06T14:24:37.000+0000" }, { "id": "199602", "author": { "name": "mpettiford", "key": "mpettiford", "displayName": "Michael Pettiford", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Closing issue\r\n\r\nTested with Ti Studio build 2.1.0.201206200844\r\nTi Mobile SDK 2.1.0.v20120619172256 hash rd3a84b13\r\nOSX Lion 10.7.3\r\niPhone 4S OS 5.1\r\n\r\nThe expected behavior is shown", "updateAuthor": { "name": "mpettiford", "key": "mpettiford", "displayName": "Michael Pettiford", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-06-21T11:27:24.000+0000", "updated": "2012-06-21T11:27:24.000+0000" } ], "maxResults": 4, "total": 4, "startAt": 0 } } }