I have a UIPageViewController
subclass that allows the user to swipe upward from the initial view controller to a second view controller. The initial view controller does not have a navigation bar (it's not connected to a UINavigationController
), but the second one does. Currently, when I swipe up to present the second view controller, there is no space in the navigation bar for the status bar. When the transition is complete, the entire view controller layout updates instantly to add the status bar space. I want to make the second view controller anticipate that the status bar will be there and add the space for it so the view doesn't jolt after the transition.
Short video clip showing the jolt
Similar, but unanswered question
EDIT:
After closely looking at the way the view controller behaves during the transition, I was able to get a good look at what is going on here.
- When I swipe up, the second view controller moves upward and aligns the top edge of the navigation bar (no status bar) with the top of the screen. It appears that the size/layout of the content is correct, so there's whitespace at the bottom that's the height of the status bar. See the screenshot:
- When the transition is finished, space for the status bar is added and the view gets shifted downward.
UIPageViewController
. My subclass only provides the two view controllers and implements the delegate'spageViewController(_:didFinishAnimating:previousViewControllers:transitionCompleted:)
– Greg Whatley