{ "id": "64068", "key": "TIMOB-3436", "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": "7", "description": "", "name": "Invalid" }, "resolutiondate": "2017-06-21T22:09:34.000+0000", "created": "2011-04-15T03:45:10.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [], "versions": [], "issuelinks": [], "assignee": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2017-06-21T22:09:34.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}

TiUITableView only fires the \"scroll\" event when the underlying\nscrollView is being dragged. There is actually a check for\nscrollView.isDragging in the scrollViewDidScroll delegate method\naround line 2020. We actually need to be notified at all times that\nthe tableview is scrolling, regardless of whether or not it's being\ndragged. This is standard functionality that is available in native\niOS and allows us to do much more with the UI. It also allows us to\ndeal with the content inset issues when using headerPullview.

\n

When you listen to a ScrollView's \"scroll\" event you get a\nboolean called \"dragging\" on the event, this should also be\navailable on the TableView's \"scroll\" event. We already modified\nthe Titanium code-base to support this in our project. We removed 3\nlines of code and added one line. The required changes are outlined\nbedlow. Also the documentation for a TableView's \"scroll\" event\nwould need to be updated to show the new boolean \"dragging\".

\n

TiUITableView.m
\nGoto line 2020 and into the method -\n(void)scrollViewDidScroll:(UIScrollView *)scrollView
\nRemove the scrollView.isDragging check
\nAdd the following to the event NSMutableDictionary:
\n[event setObject:NUMBOOL([scrollView isDragging])\nforKey:@\"dragging\"];

\n

Best,

\n

Brian

{html}", "attachment": [], "flagged": false, "summary": "iOS: tableview \"scroll\" event only fires when dragging", "creator": { "name": "brian", "key": "brian", "displayName": "Brian", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "brian", "key": "brian", "displayName": "Brian", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "130694", "author": { "name": "brian", "key": "brian", "displayName": "Brian", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

I went ahead and made the changes...here is the pull\nrequest:

\n

https://github.com/appcelerator/titanium_mobile/pull/85

\n

Thanks,

\n

Brian

{html}", "updateAuthor": { "name": "brian", "key": "brian", "displayName": "Brian", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:45:10.000+0000", "updated": "2011-04-15T03:45:10.000+0000" }, { "id": "130695", "author": { "name": "thiago", "key": "thiago", "displayName": "Thiago", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Hi Brian, I have some problems too with pull to refresh solution\nwith iphone <= 3G, as you mentioned.
\nI implemented your fix and still have some delay on scrollend to\nset some control variables.

\n

Well, I would like to know how you fixed pull to refresh issues\nwith your fix.

\n

Thanks.

{html}", "updateAuthor": { "name": "thiago", "key": "thiago", "displayName": "Thiago", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:45:10.000+0000", "updated": "2011-04-15T03:45:10.000+0000" }, { "id": "130696", "author": { "name": "brian", "key": "brian", "displayName": "Brian", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

@Thiago,

\n

On your tableView's scroll event you have to check for dragging\nand if it's not dragging but is reloading then you force the\nheaderPullView to show. Here is an example:

\n
\ntableView.addEventListener('scroll', function(e) {\n    var offset = e.contentOffset.y;\n\n    if (e.dragging && !reloading) {\n        if (!pulling && offset <= -65.0) {\n            pulling = true;\n            var t = Ti.UI.create2DMatrix();\n            t = t.rotate(-180);\n            arrow.animate({transform:t,duration:100});\n            statusLabel.text = \"Release to update...\";\n        }\n        else if (pulling && offset > -65.0 && offset < 0) {\n            pulling = false;\n            var t = Ti.UI.create2DMatrix();\n            arrow.animate({transform:t,duration:100});\n            statusLabel.text = \"Pull down to update...\";\n        }\n    }\n    if (!e.dragging && reloading) {\n        tableView.scrollToTop(-65, {animated:true});\n    }\n});\n
{html}", "updateAuthor": { "name": "brian", "key": "brian", "displayName": "Brian", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:45:10.000+0000", "updated": "2011-04-15T03:45:10.000+0000" }, { "id": "130697", "author": { "name": "thiago", "key": "thiago", "displayName": "Thiago", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Ohh, I was doing everything right, except using scrollToTop. I\nwas using the bugged setContentInsets instead of scrollToTop (by\nthe way, if you set animated to true, it goes to the top and then\nthe scroll goes to the desired position - is there a way to fix\nthis [the best solution I found was setting animated to\nfalse]?).

\n

Thanks! And I hope they can fix all this weird code and all\ndevelopers like us can sleep better in the end of the day.

{html}", "updateAuthor": { "name": "thiago", "key": "thiago", "displayName": "Thiago", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:45:10.000+0000", "updated": "2011-04-15T03:45:10.000+0000" }, { "id": "130698", "author": { "name": "brian", "key": "brian", "displayName": "Brian", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Ya setting animated to false is probably the best way...glad you\nwere able to get everything working :)

{html}", "updateAuthor": { "name": "brian", "key": "brian", "displayName": "Brian", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:45:11.000+0000", "updated": "2011-04-15T03:45:11.000+0000" }, { "id": "422517", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket due to time passed and lack of progress for a number of years. Any problems, please file a new ticket.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-06-21T22:09:34.000+0000", "updated": "2017-06-21T22:09:34.000+0000" } ], "maxResults": 6, "total": 6, "startAt": 0 } } }