andreamazz / AMScrollingNavbar

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

Bug fix: updateNavbarAlpha() unnecessarily persisting dimmed tint #374

Closed tifroz closed 4 years ago

tifroz commented 4 years ago

Context: under most circumstances, UIKit will automatically dim the navigation bar when the keyboard pops up (unless tintAdjustmentMode is set to normal)

If ScrollingNavigationController's updateNavbarAlpha() is called while the keyboard is up, the line navigationBar.tintColor = navigationBar.tintColor.withAlphaComponent(alpha) will cause the dimmed tint to be permanent.

The events windowDidBecomeVisible and didRotate will typically be fired when the keyboard pops up. For both events showNavbar() will be invoked, which in turn will call updateNavbarAlpha() and exit immediately. This call to updateNavbarAlpha() can be harmful as described above, and I can't see a scenario where it would be helpful so I removed it completely.

andreamazz commented 4 years ago

I agree, I see no point to that call, merging.

Thanks