{ "id": "63155", "key": "TIMOB-2523", "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": { "id": "3", "description": "The problem is a duplicate of an existing issue.", "name": "Duplicate" }, "resolutiondate": "2012-07-26T12:31:49.000+0000", "created": "2011-04-15T03:21:53.000+0000", "priority": { "name": "Trivial", "id": "5" }, "labels": [], "versions": [ { "id": "11225", "name": "Release 1.5.0", "archived": true, "released": true, "releaseDate": "2010-12-14" } ], "issuelinks": [ { "id": "19341", "type": { "id": "10002", "name": "Duplicate", "inward": "is duplicated by", "outward": "duplicates" }, "outwardIssue": { "id": "63136", "key": "TIMOB-2504", "fields": { "summary": "Scrollview: problem with views larger than window width", "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" } }, "priority": { "name": "Low", "id": "4" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } }, { "id": "19342", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "94532", "key": "TIMOB-9901", "fields": { "summary": "TiAPI: Review and clean up platform bugs and reduce bug count by 20%.", "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" } }, "priority": { "name": "High", "id": "2" }, "issuetype": { "id": "7", "description": "gh.issue.story.desc", "name": "Story", "subtask": false } } } } ], "assignee": { "name": "ngupta", "key": "ngupta", "displayName": "Neeraj Gupta", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2012-07-26T21:41:49.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": "{html}

I submit a simple example of a scrollableview with 3 imageviews\r\nwhich are wider than the window's width.

\r\n

The imageviews of three images 1024x1440 pixels (placed as\r\nbackgrounds to allow zooming) are sized to the maximum height of\r\nthe window, and therefore with a wider width; than added to the\r\nscrollableview.
\r\nThe images are double pages of a catalog.

\r\n

Scrollableview correctly shows just the visible part of the\r\nimage, but trying to move right showing the other part of the\r\nimage, it scrolls to the following view.
\r\nIf you try to first pinch in or out the image (zooming), then\r\nscrollableview acts correctly first panning and then scrolling.

\r\n

The attachments contains app.js, scrollview_problem.js and the\r\nthree images.
\r\nPut them in the resource folder of a new project.
\r\nI have Titanium developer 1.2.1, iphone SDK 4.2 and mobile titanium\r\nsdk 1.4.2.

{html}", "attachment": [ { "id": "18160", "filename": "scrollview_problem_prj_resources.zip", "author": { "name": "trident", "key": "trident", "displayName": "trident", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:21:54.000+0000", "size": 673038, "mimeType": "application/zip" } ], "flagged": false, "summary": "iOS: ScrollableView problems showing imageviews larger than screen", "creator": { "name": "trident", "key": "trident", "displayName": "trident", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "trident", "key": "trident", "displayName": "trident", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "128693", "author": { "name": "trident", "key": "trident", "displayName": "trident", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

I solved patching the objective C source of the ScrollableView\nclass.
\nI saw that the inner scrollviews created by the class for each view\nwere not aware of the content size of the view itself. After the\nfirst zoom gesture they were and the scrolling was ok. So I\nmodified the source that creates the inner scrollviews to set the\ncontentsize property according to the size of the internal\nview.

\n

This is the complete source of the refreshScrollView method from\nthe ScrollableView.m file (mobile SDK 1.5.1).
\nThe lines added are between comments.

\n

Hope it's useful to somebody and please take this into\nconsideration in the next mobile sdk release.

\n
\n\n-(void)refreshScrollView:(CGRect)visibleBounds readd:(BOOL)readd\n{\n// start code added by Trident\n    TiViewProxy *viewproxy;\n    TiUIView *mview;\n    CGRect vbounds;\n// end code added by Trident\n\n    CGRect viewBounds;\n    viewBounds.size.width = visibleBounds.size.width;\n    viewBounds.size.height = visibleBounds.size.height - (showPageControl ? pageControlHeight : 0);\n    viewBounds.origin = CGPointMake(0, 0);\n    \n    UIScrollView *sv = [self scrollview];\n    \n    [self refreshPageControl];\n    \n    if (readd)\n    {\n        for (UIView *view in [sv subviews])\n        {\n            [view removeFromSuperview];\n        }\n    }\n    \n    for (int c=0;c<[views count];c++)\n    {\n        viewBounds.origin.x = c*visibleBounds.size.width;\n        \n        if (readd)\n        {\n// start code added by Trident\n            viewproxy = [views objectAtIndex:c];    \n            mview = [viewproxy view];\n            vbounds = [mview bounds];\n// end code added by Trident\n            //TODO: optimize for non-scaled?\n            InnerScrollView *view = [[InnerScrollView alloc] initWithFrame:viewBounds];\n            [view setMaximumZoomScale:maxScale];\n            [view setMinimumZoomScale:minScale];\n            [view setShowsVerticalScrollIndicator:NO];\n            [view setShowsHorizontalScrollIndicator:NO];\n            [view setDelegate:view];\n//          [view setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight];\n            [view setPagingEnabled:NO];\n            [view setBackgroundColor:[UIColor clearColor]];\n            [view setDelaysContentTouches:NO];\n// start code added by Trident\n            [view setContentSize:vbounds.size];\n// end code added by Trident            \n            [sv addSubview:view];\n            [view release];\n        }\n        else \n        {\n            UIView *view = [[sv subviews] objectAtIndex:c];\n            view.frame = viewBounds;\n        }\n    }\n    \n    if (currentPage==0)\n    {\n        [self loadNextFrames:true];\n    }\n    \n    if (readd)\n    {\n        [self renderViewForIndex:currentPage];\n    }\n    \n    CGRect contentBounds;\n    contentBounds.origin.x = viewBounds.origin.x;\n    contentBounds.origin.y = viewBounds.origin.y;\n    contentBounds.size.width = viewBounds.size.width;\n    contentBounds.size.height = viewBounds.size.height-(showPageControl ? pageControlHeight : 0);\n    contentBounds.size.width *= [views count];\n    \n    [sv setContentSize:contentBounds.size];\n    [sv setFrame:CGRectMake(0, 0, visibleBounds.size.width, visibleBounds.size.height)];\n}\n
{html}", "updateAuthor": { "name": "trident", "key": "trident", "displayName": "trident", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:21:54.000+0000", "updated": "2011-04-15T03:21:54.000+0000" }, { "id": "128694", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Need to discuss whether it's appropriate behavior to swipe\nimmediately to the next view, or to pan across current view\ncontent.

{html}", "updateAuthor": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:21:55.000+0000", "updated": "2011-04-15T03:21:55.000+0000" }, { "id": "209702", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Dupe of TIMOB-2504.", "updateAuthor": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-07-26T12:31:49.000+0000", "updated": "2012-07-26T12:31:49.000+0000" } ], "maxResults": 3, "total": 3, "startAt": 0 } } }