AMScrollingNavbar icon indicating copy to clipboard operation
AMScrollingNavbar copied to clipboard

Tab bar translucent when hiding

Open lawicko opened this issue 8 years ago • 2 comments

Hi, first of all, thanks for this great library! I have noticed that when I add the tab bar as a follower it becomes translucent when animated. Why is that? Also, I noticed there is an arbitrary factor of 1.5 by which the delta is multiplicated. I think this assures that the bar hides entirely, but I have discovered that it's enough to multiply by 1.11 (at least for iPhone5 and iPhone6) - this is useful if you animate additional followers together with the tab bar.

I use: pod 'AMScrollingNavbar', '3.4.0'

The code I'm asking about is lines 352-353 in the ScrollingNavigationController:

tabBar.isTranslucent = true
tabBar.frame.origin.y += delta * 1.5

Edit: Also, when I want to have a solid tab bar at all times, I need to remove all the offsets, like in line 26 of ScrollingNavbar+Sizes.swift. I have a feeling that I'm missing something here, is there a switch somewhere to allow solid tab bar?

lawicko avatar Aug 16 '17 07:08 lawicko

Hi @lawicko sorry for the delay in this response. That code was implemented in a PR: https://github.com/andreamazz/AMScrollingNavbar/commit/fb0482ef46f7dc980fcecb7fe54e49d74b928347 I honestly don't remember why the bar is set to translucent during the movement, I'd have to do some more digging.

andreamazz avatar Aug 30 '17 15:08 andreamazz

@andreamazz I think it is translucent to allow underlaying content to expand when the tab bar is hiding. This can be checked by commenting out the lines responsible for making it translucent and then scrolling. You can see that the content of the selected view controller will not expend below of what supposedly is a bottom layout guide. When the bar is translucent, this layout guide moves to the bottom of the window. One workaround may be to only make the tab bar translucent when it hides from the view, I tried changing this but it looks bad when the are of the tab bar is occupied by empty space before the bar disappears from view. I will have to thing of something smarter.

lawicko avatar Mar 13 '18 08:03 lawicko