andreamazz / AMScrollingNavbar

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

Tab bar stays translucent #307

Closed lawicko closed 6 years ago

lawicko commented 6 years ago

I'm pretty sure this is connected with #304 basically when the frame is compared to check if the tab bar returned to the original position, the comparison fails most of the time (tested on iPhone 6s) because of this line: tabBar.frame.origin.y += delta * (tabBar.frame.height / navigationBar.frame.height) Before the delta was multiplied by 1.5 so the comparison had a better chance of succeeding. Now there may be more numbers after the comma and this causes the failure.

I have fixed it locally by: let frame = CGRect(x: tab.frame.origin.x, y: CGFloat(round(tab.frame.origin.y)), width: tab.frame.width, height: tab.frame.height) self.sourceTabBar = UITabBar(frame: frame) in line 136 of the ScrollingNavigationController.swift

and this: if let originalTabBar = sourceTabBar, originalTabBar.frame.origin.y == round(tabBar.frame.origin.y) { in line 390 of the same file.

andreamazz commented 6 years ago

Good point. I've applied your fix in 21f98ce.

Thanks!