[TIMOB-3436] iOS: tableview "scroll" event only fires when dragging
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2017-06-21T22:09:34.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | iOS |
Labels | n/a |
Reporter | Brian |
Assignee | Ingo Muschenetz |
Created | 2011-04-15T03:45:10.000+0000 |
Updated | 2017-06-21T22:09:34.000+0000 |
Description
TiUITableView only fires the "scroll" event when the underlying scrollView is being dragged. There is actually a check for scrollView.isDragging in the scrollViewDidScroll delegate method around line 2020. We actually need to be notified at all times that the tableview is scrolling, regardless of whether or not it's being dragged. This is standard functionality that is available in native iOS and allows us to do much more with the UI. It also allows us to deal with the content inset issues when using headerPullview.
When you listen to a ScrollView's "scroll" event you get a boolean called "dragging" on the event, this should also be available on the TableView's "scroll" event. We already modified the Titanium code-base to support this in our project. We removed 3 lines of code and added one line. The required changes are outlined bedlow. Also the documentation for a TableView's "scroll" event would need to be updated to show the new boolean "dragging".
TiUITableView.m
Goto line 2020 and into the method -
(void)scrollViewDidScroll:(UIScrollView *)scrollView
Remove the scrollView.isDragging check
Add the following to the event NSMutableDictionary:
[event setObject:NUMBOOL([scrollView isDragging])
forKey:@"dragging"];
Best,
Brian
I went ahead and made the changes...here is the pull request:
https://github.com/appcelerator/titanium_mobile/pull/85">https://github.com/appcelerator/titanium_mobile/pull/85
Thanks,
Brian
Hi Brian, I have some problems too with pull to refresh solution with iphone <= 3G, as you mentioned.
I implemented your fix and still have some delay on scrollend to set some control variables.
Well, I would like to know how you fixed pull to refresh issues with your fix.
Thanks.
@Thiago,
On your tableView's scroll event you have to check for dragging and if it's not dragging but is reloading then you force the headerPullView to show. Here is an example:
Ohh, I was doing everything right, except using scrollToTop. I was using the bugged setContentInsets instead of scrollToTop (by the way, if you set animated to true, it goes to the top and then the scroll goes to the desired position - is there a way to fix this [the best solution I found was setting animated to false]?).
Thanks! And I hope they can fix all this weird code and all developers like us can sleep better in the end of the day.
Ya setting animated to false is probably the best way...glad you were able to get everything working :)
Closing ticket due to time passed and lack of progress for a number of years. Any problems, please file a new ticket.