UIPageViewController: Child Controller ignoring status bar height during scrolling

筅森魡賤 提交于 2019-12-04 11:00:46

问题


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?

  • 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!


回答1:


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!



来源:https://stackoverflow.com/questions/26510725/uipageviewcontroller-child-controller-ignoring-status-bar-height-during-scrolli

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!