Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scrolling Indicator Gets Stuck When Bouncing Is Disabled for UIScrollView

I have this problem, and I can't find any other mention of this anywhere.

Basically, if I disable bouncing in a UIScrollView (so derivatives such as UITableView are also affected) it's possible to get the scroll indicator stuck if a user scrolls to the top, and then, with another gesture, tries to continue scrolling using a quick swipe.

Once this happens, the scroll indicator will not disappear unless a user scrolls again or taps the scrollview. The biggest issue is that the scrollview will capture that tap and so if you try to tap on say a table cell, nothing will happen the first time.

I've tested this with just a barebones app on both my device and the simulator, and it seems to just be a general issue with UIScrollView and disabling bouncing; however, like I said I can't find any other mention of this on the internet.

Is this just a bug? Is this expected behavior? Am I doing something wrong? If this is a bug, then does anyone know of a work-around or fix?

like image 630
Daniel James Avatar asked Jun 09 '13 00:06

Daniel James


1 Answers

In my case, I had two UIScrollView s, one nested inside the other. When inner scroll view reached the top, I forcibly set the contentOffset.y to 0 (I need this to allow outer scroll view begin scrolling its content view). This caused the scroll view undesired behavior described in this question.

The fix was setting the contentOffset.y to -1, which allowed the scroll view scroll back to 0 naturally (by itself), and the hung behavior was dismissed.

Hope this helps the others ✋

like image 165
Almas Adilbek Avatar answered Nov 07 '22 13:11

Almas Adilbek