andreamazz / AMScrollingNavbar

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

ScrollingNavigationController.updateNavbarAlpha steps on third party toolbar buttons #323

Open tigaris opened 6 years ago

tigaris commented 6 years ago

updateNavbarAlpha hammers the alphas of all subviews of everything on the toolbar, including some third party libraries we use that do special things with their toolbar buttons.

the specific problem is the nested function:

    func setAlphaOfSubviews(view: UIView, alpha: CGFloat) {
        view.alpha = alpha
        view.subviews.forEach { setAlphaOfSubviews(view: $0, alpha: alpha) }
    }

the easiest solution would be to make this function a public function instead of nested function inside a private function, so we could just override the behavior with our own logic.

otherwise adding a property ScrollingNavigationController to exclude button subviews by name or class would be needed.

andreamazz commented 6 years ago

Hi @tigaris I like the second approach better, I'll add it to the next release

andreamazz commented 6 years ago

Can you check branch issue-323 and test the hideExclusions field?

yvdorofeev commented 5 years ago

Has this issue been fixed?

On the same note, is it necessary to recursively process all subviews? I would think if you set alpha on parent view, it'll just hide or show all its subviews.

The particular issue I'm having is a simple text field with placeholder in title view. This recursive processing on view load sets alpha to 1 on the placeholder and it appears black instead of light gray. I just ended up commenting out that line for the time being.