I've got a UIViewController
(VC
) nested in UIPageViewController
in a UINavigationController
in a UITabBarController
(UIViewController < UIPageViewController < UINavigationController < UITabBarController
).
Since I'd like to use the entire screen for photos in my VC
, the frame should be covering the entire screen as well. A UIImageView
shall be added as a subview to the view
of my VC
and due to a couple of other reasons I want the user to make the tabBar
disappear using animations (navigationController?.setNavigationBarHidden(true, animated: animated)
is used in my UIPageViewController
to hide the navigation bar). Hiding the tabBar
via animations seems to be a little harder in my case, however:
When I used animations to hide the bar I noticed that the view
in the VC
is cut off by the height of the tab bar. I was curious what view was above the bar and played with the backgroundColors
in the parent views, i.e. UINavigationController
and UIPageViewController
and managed to find out that this was the UINavigationController
. In a previous project I used edgesForExtendedLayout = []
and it did what I desire now. I've tried using it in individual controllers and in many controllers at the same time. Nothing's worked so far.
To get the height of the view I used viewDidLayoutSubviews
(it was smaller than it was supposed to be) and I managed to correct it using viewWillLayoutSubviews
(print
tells me its height is equal to UIScreen.main.bounds.height
). Nonetheless, it isn't visible and therefore probably clipped by (apparently) the UINavigationController
.
Does anyone know what's causing the problem and how it could possibly be fixed? I'd appreciate your help!
EDIT:
Also tried setting view.frame
s equal to one another (VC's = PageVC's and PageVC's = NavigationVC's) didn't do the job, either. Debugging the view hierarchy indicates that the VC.view
and PageVC.view
are still cut off.