8

I'm having some trouble with a UIPageViewController. If I scroll to a new page, the new view controller is behind the status bar while I'm scrolling. After the scrolling, the view controller position itself below the status bar.

I'm using Storyboard (Universal). UIPageViewController has attribute Extend Edges: Under Top Bars. What am I missing?

enter image description here

  • set automaticallyAdjustsScrollViewInsets to false didn't work
  • use of edgesForExtendedLayout = UIRectEdge.None didn't work either
  • found some open questions here but no answers ( link )

UPDATE

Another reason for the jumping are 'Margins' from 'Constraints' (found here). Ensure that you uncheck margins if you use constraints (right Dialog). You can remove them later in the Utilities (left Dialog). Check both of the connected views!

enter image description here

Community
  • 1
  • 1
longi
  • 11,104
  • 10
  • 55
  • 89
  • Just stumbled across the exact same problem and still haven't found an answer :( Please let me know if you get it working – benjamin.ludwig Oct 23 '14 at 11:53
  • I can't reproduce it, all pages are behind by status bar regardless of scrolling or not, if I set pageViewController's frame's original Y to 20, all pages are not behind it. A example project will be of some help. – gabbler Oct 29 '14 at 06:19

1 Answers1

4

I just found a possible solution:

In my case, the UIPageViewController container had a Top Space of 0 constraint to its superview. The superview was the root container which contains the status bar.

I changed the value of the Top Space to 20, which is higher than the status bar. Now it doesn’t move the views below the status bar, because they already are.

Hope that helps!

benjamin.ludwig
  • 1,575
  • 18
  • 28