{ "id": "171945", "key": "TIMOB-26221", "fields": { "issuetype": { "id": "7", "description": "gh.issue.story.desc", "name": "Story", "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": { "id": "10000", "description": "", "name": "Done" }, "resolutiondate": "2018-07-20T14:53:31.000+0000", "created": "2018-07-20T13:24:49.000+0000", "priority": { "name": "None", "id": "6" }, "labels": [], "versions": [], "issuelinks": [], "assignee": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "updated": "2018-08-06T17:34:44.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": "Hello,\r\n\r\nThe customer is using the scrollView with Horizontal layout and adding the required UI elements to a main view and adding it back to the actual scrollview. Even after fixing the height of scrollView equal to that of main view inside it, its still scrolling vertically which is not an expected behaviour. \r\n\r\nThe sample code to replicate the issue in iPAD pro 12.9 inch (2nd generation) and other bigger iPAD's. \r\n\r\n*Sample code:*\r\n{code}\r\nvar window = Ti.UI.createWindow();\r\n\r\nvar osname = Ti.Platform.osname;\r\nfunction pixelsToDipUnits(pixels) {\r\n\tif ((osname === 'iphone') || (osname === 'ipad')) {\r\n\t\treturn pixels;\r\n\t}\r\n\tif (Titanium.Platform.displayCaps.dpi > 160)\r\n\t\treturn (pixels / (Titanium.Platform.displayCaps.dpi / 160));\r\n\telse\r\n\t\treturn pixels;\r\n};\r\nTi.App.PLATFORM_HT = pixelsToDipUnits(Ti.Platform.displayCaps.platformHeight);\r\nTi.App.PLATFORM_WD = pixelsToDipUnits(Ti.Platform.displayCaps.platformWidth);\r\n\r\nvar scrollView = Ti.UI.createScrollView({\r\n\theight : 0.09 * Ti.App.PLATFORM_HT,\r\n\ttop : 8,\r\n\tverticalBounce : false,\r\n\twidth : Ti.UI.FILL,\r\n\tlayout : 'horizontal',\r\n\tbubbleParent : false,\r\n\tborderColor : 'green',\r\n\tbackgroundColor : 'white',\r\n\tscrollType : 'horizontal'\r\n});\r\nfor (var i = 0; i < 10; i++) {\r\n\tvar mainSubView = Ti.UI.createView({\r\n\t\theight : 0.09 * Ti.App.PLATFORM_HT,\r\n\t\tbackgroundColor : 'white',\r\n\t\twidth : 0.22 * Ti.App.PLATFORM_WD,\r\n\t\tborderColor : 'red'\r\n\t});\r\n\tvar subView = Ti.UI.createView({\r\n\t\twidth : 0.22 * Ti.App.PLATFORM_WD,\r\n\t\tlayout : 'vertical',\r\n\t\theight : Ti.UI.SIZE,\r\n\t\tborderColor : 'blue'\r\n\t});\r\n\r\n\tsubView.add(Ti.UI.createImageView({\r\n\t\timage : '/clock.png',\r\n\t\ttouchEnabled : false,\r\n\t\theight : Ti.UI.SIZE\r\n\t}));\r\n\r\n\tmainSubView.add(subView);\r\n\tscrollView.add(mainSubView);\r\n}\r\nwindow.add(scrollView);\r\nwindow.open();\r\n{code}\r\n\r\n*Test Environment:*\r\nAppcelerator Command-Line Interface, version 7.0.4\r\nSDK: 7.2.0.GA, 7.1.1 GA\r\niOS device: iPAD pro 12.9 inch (2nd generation)\r\n\r\nThanks", "attachment": [ { "id": "65366", "filename": "clock.png", "author": { "name": "rislam", "key": "rislam", "displayName": "Riduanul Islam", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-07-20T13:24:24.000+0000", "size": 2048, "mimeType": "image/png" }, { "id": "65368", "filename": "TIMOB-26221.mp4", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-07-20T14:06:23.000+0000", "size": 261140, "mimeType": "video/mp4" } ], "flagged": false, "summary": "iOS : ScrollView content scrolling vertically in bigger iPads when using percent-based layout", "creator": { "name": "rislam", "key": "rislam", "displayName": "Riduanul Islam", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "rislam", "key": "rislam", "displayName": "Riduanul Islam", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "iOS, ScrollView", "closedSprints": [ { "id": 1053, "state": "closed", "name": "2018 Sprint 15 SDK", "startDate": "2018-07-15T21:52:05.453Z", "endDate": "2018-07-29T21:52:00.000Z", "completeDate": "2018-07-29T22:25:11.723Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "439359", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "It works fine for me, no vertical scrolling occurs. See the video attached. Using iOS 11.4 and Xcode 9.4.\r\n\r\n*EDIT*: That was on a 9.7\" one. I can reproduce it on a 12.9\" one, which leads me to the thought that the scale factor and/or dpi's may be different and therefore need to be respected in calculating the height.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-07-20T13:34:58.000+0000", "updated": "2018-07-20T14:42:22.000+0000" }, { "id": "439363", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Ok, found the issue - and not really an issue. The problem is that iOS is not really the biggest friend of percentage based calculations (does not support it), but we do. But if a percentage based calculation results in a floating number (in this case 122.94), it cannot pass it to the layout system properly and uses CGSizeZero instead. \r\n\r\nLong story short, you just need to round the number and it works fine, e.g. {{Math.ceil(0.09 * Ti.App.PLATFORM_HT)}}.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-07-20T14:53:31.000+0000", "updated": "2018-07-20T14:53:31.000+0000" }, { "id": "439822", "author": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Closed as completed. If this is in error, please reopen.", "updateAuthor": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-08-06T17:34:44.000+0000", "updated": "2018-08-06T17:34:44.000+0000" } ], "maxResults": 4, "total": 4, "startAt": 0 } } }