andreamazz / AMScrollingNavbar

Scrollable UINavigationBar that follows the scrolling of a UIScrollView
MIT License
6.05k stars 633 forks source link

Twitchy scroll indicator #39

Closed cojoj closed 10 years ago

cojoj commented 10 years ago

First of all, this library is awesome and thanks a lot for sharing it with community!

I've found a little but confusing bug (devil is in the detail). Here is a little description: When you scroll down and AMScrollingNavbar starts hiding (you have to do it slowly) and you gently move your finger in other direction (left or right) but still keep scrolling down you'll face a little twitching of scroll indicator.

I've also tested your demo app and it is facing the same issue. For a better visiualization (I hope becuse the movie quality is poor) take a look at this movie.

I suggest you test it by yourself! And answer me if you've also had the same problem or maybe a solution! I know you can always hide scroll indicator but it's nice to show user when he currently is :)

andreamazz commented 10 years ago

Hi @cojoj I think you linked the wrong video :D

cojoj commented 10 years ago

@andreamazz my bad! Sorry for this mistake :confused: Now you can see the good one :smiley:

andreamazz commented 10 years ago

Hi @cojoj Yep, I'm aware of this issue and to be honest I have no idea how to fix it. It looks like the scrollbar shifts and widens when the view expands or shrinks, then it goes back to its original position, back and forth every pixel.

Actually, while I was describing the problem it came to me.... it's autolayout. If you disable autolayout in the view, the scrollbar behaves like a good sport.
huh. I need to investigate further.

cojoj commented 10 years ago

I have another view but with pinned UISearchBar to the bottom of UINavigationBar and in that view with autolayout turned on and this effect is not visible so badly... This one is very interesting because I don't see any dependencies which may cause this bug!

It's a bit confusing and I will try to implement custom scroll indicator and see if it's working. Would be a shame if I have to turn the autolayout off :confused:

cojoj commented 10 years ago

@andreamazz I've checked another view in my application which uses AMScrollingNavbar and it's free of bugs! Take a look at it:
Groups view
It's strange because in this view I use autolayout and scroll indicator. What is different in comaprison to the first view - I have SSPullToRefresh here and UISearchBar always visible (like in Contacts). I've also cahnged insets to fit the whole layout.

andreamazz commented 10 years ago

Yesterday I've been working on some improvements, and I could swear that some builds were bug free, but in the next build the bug was back again. It's driving me insane :)
I'll try tinkering with insets.

cojoj commented 10 years ago

Please check pull-to-refresh as well... Might be something with this!
Also, I don't know if this is the same issue but when I scroll down there is a little slip when sections change. I the bug-free view this effect doesn't appear as well.

cojoj commented 10 years ago

I think I have this one :smiley: As you've mentioned before, it's because of autolayout! In your README.md file you instruct to set the constraints of UIScrollView to fill the whole window. When you do that, scroll indicator begins it's dance. When you leave UIScrollView without any constraint, it works fine.

andreamazz commented 10 years ago

Nice finding!
This could be a problem when someone needs autolayout constraints in his scrollview though :/
This is going to be a pain to figure out

andreamazz commented 10 years ago

I decided to disable the scrollbar while the navbar scrolls up or down, since the content of the scrollview isn't really scrolling...
I'm not a fan of this solution, but for now it's the only thing that I can think of.

cojoj commented 10 years ago

You should check CustomScrollIndicator. Maybe it'll work and you geat rid of this nasty bug.