andreamazz / AMScrollingNavbar

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

Child view controller's layout preferences are not being respected #364

Closed evil159 closed 5 years ago

evil159 commented 5 years ago

Describe the bug

Currently topViewController's view size is adjusted together navigation bar size in case when navigation bar is not translucent - which is reasonable as child view controller views are placed below navigation bar. However, even with opaque navigation bar there is a way to make child view controllers extend beyond the bar - using extendedLayoutIncludesOpaqueBars - it makes the system to treat child view controller's view pretty much in the same way as it would if navigation bar was translucent. The same way a view controller can opt out from being extended even if presented under navigation bar - by modifying edgesForExtendedLayout.

Described setup does not seem to be working well together with AMScrollingNavbar - it does not respect current view controller's preferences which results in visual artefacts.

To Reproduce

This is reproduced by surprising AMScrollingNavbar with a view controller that either extends under opaque navigation bar or doesn't extend under translucent one.

navigationController?.navigationBar.isTranslucent = false
extendedLayoutIncludesOpaqueBars = true

or

navigationController?.navigationBar.isTranslucent = true
edgesForExtendedLayout = [.left, .right, .bottom]

Screenshots Simulator Screen Shot - iPhone 8 - 2019-07-10 at 16 41 27 Simulator Screen Shot - iPhone 8 - 2019-07-10 at 16 17 05

Example project Example.zip