LeoNatan / LNPopupController

A framework for presenting view controllers as popups of other view controllers, much like the Apple Music and Podcasts apps.
MIT License
3.03k stars 340 forks source link

Overlapping view layout issue #175

Closed kjantzer closed 7 years ago

kjantzer commented 7 years ago

I'm having issues with the view controllers in a tabbarcontroller being covered by the "now playing bar". I tried looking at #131 but haven't been able to apply that to my problem.

My pseudo code layout is:

let mainVC = UITabBarController

mainVC.viewControllers = [libraryVC, storeVC, settingsVC] // all 3 view controllers are UINavigationControllers

mainVC.presentPopupBar(withContentViewController: popupVC, animated: true, completion: nil)

My tabbar view controllers all get clipped by the popup bar: screen shot 2017-08-14 at 4 50 27 pm

What am I missing?

FYI: I am using a custom LNPopupCustomBarViewController, could that be related to the problem?

LeoNatan commented 7 years ago

This is on purpose. A normal popup bar is translucent, and so, it goes above the content so that it may be seen under. This should also be the behavior of the tab bar (and navigation bar), unless you specified differently. I don't think I support (or want to support) edgesForExtendedLayout and extendedLayoutIncludesOpaqueBars, where you specify that your view should shrink.

Instead, you should either set the bottom insets, in case of a scroll view, or use constraints to the bottom layout guide.

kjantzer commented 7 years ago

Do I need to apply the constraints on each of the tabbar view controllers? tabBar.viewControllers = [libraryVC, storeVC, settingsVC]

LeoNatan commented 7 years ago

Each view controller has a bottom layout guide. If you set constraints against that, everything should look correctly.

kjantzer commented 7 years ago

Would you be able to point me in the right direction?

LeoNatan commented 7 years ago

You can look at the example projects to see. In the music demo, there is a scroll view. In the others, there is a constraint against the bottom layout guide.