本文介绍了UIPageViewController:子控制器在滚动期间忽略状态栏高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我在使用 UIPageViewController 时遇到了一些问题。如果我滚动到新页面,新的视图控制器后面状态栏,而我正在滚动。滚动后,视图控制器将自身置于状态栏下方。 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. 我正在使用Storyboard(Universal)。 UIPageViewController 具有属性 Extend Edges:在Top Bars 下。我缺少什么?I'm using Storyboard (Universal). UIPageViewController has attribute Extend Edges: Under Top Bars. What am I missing? 设置 automaticAdjustsScrollViewInsets 为false无法正常工作 使用 edgesForExtendedLayout = UIRectEdge.None 无法正常工作 在这里找到一些未解决的问题,但没有答案(链接) set automaticallyAdjustsScrollViewInsets to false didn't workuse of edgesForExtendedLayout = UIRectEdge.None didn't work eitherfound some open questions here but no answers ( link ) 更新 跳跃的另一个原因是来自'约束'的'边距'(在此处找到)。如果使用约束(右对话框),请确保取消选中边距。您可以稍后在实用程序中将其删除(左侧对话框)。检查两个连接的视图!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! 推荐答案我刚刚找到了一个可能的解决方案:I just found a possible solution: In我的情况是, UIPageViewController 容器的超级视图有 Top Space of 0 约束。 superview是包含状态栏的根容器。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.我更改了 Top Space的值到20,高于状态栏。现在它不会移动状态栏下面的视图,因为它们已经存在。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.希望有所帮助! 这篇关于UIPageViewController:子控制器在滚动期间忽略状态栏高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-26 22:42