andreamazz / AMScrollingNavbar

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

Fix #302: View background shows through during animation #359

Closed sitomani closed 5 years ago

sitomani commented 5 years ago

As reported in #302, the host viewcontroller background shows through in the bottom of the view during showNavBar animation in TableView, WebView and CollectionView examples in the Demo app. This commit addresses the issue by taking the delta into account when calculating the frame size changes in updateSizing.

I have tested this fix with the changes to demo app as implemented in @Alexookah 's fork at https://github.com/Alexookah/AMScrollingNavbar and the background color viewing through is not reproducing with this fix.

sitomani commented 5 years ago

After a bit of additional debugging I noticed that while my initial fix indeed makes the reported problem disappear, it still is not quite correct - occasionally the view gets resized too small in height when the scrolling direction is up.

I'm going to work on this a bit over the next weekend and see if I can get it sorted out.

sitomani commented 5 years ago

I'm closing this PR, there's more to the issue with non-translucent navigationbar here than meets the eye. Also the follower toolbar seems to be behaving differently depending when running with different translucency setting for the NavBar, occasionally drawing under the navbar (e.g. when the search bar appears inside navbar).

Surprisingly it seems that while the view origin is animated, the height changes immediately in the updateSizing call, causing the short period of background color showing through at the bottom of the screen.

andreamazz commented 5 years ago

Hey @sitomani I've had my fair share of head scratching on this issue. I really appreciate the help on this.