xcode iPhone X - 安全区没有实现全屏体验?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/46275330/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
iPhone X - Safe Area does not achieve full-screen experience?
提问by Fabrizio Prosperi
The new HIG for iPhone X available here, specify: "Provide a full-screen experience. Make sure backgrounds extend to the edges of the display, and that vertically scrollable layouts, like tables and collections, continue all the way to the bottom."
此处提供的适用于 iPhone X 的新 HIG指定:“提供全屏体验。确保背景延伸到显示器的边缘,并且垂直可滚动的布局,如表格和收藏夹,一直延伸到底部。”
Now I'd like to understand how to accomplish that with Xcode 9 GM, since it seems to me that the only view allowed to extend to the whole screen is the UIViewController root view, and that whenever I try to drag constraints for a view above that, i.e. WKWebView to the root view, the constraints get actually connected to the safe area, leaving both the top and bottom areas empty as displayed in the storyboard here:
现在我想了解如何使用 Xcode 9 GM 来实现这一点,因为在我看来,唯一允许扩展到整个屏幕的视图是 UIViewController 根视图,并且每当我尝试拖动上方视图的约束时也就是说,即 WKWebView 到根视图,约束实际上连接到安全区域,使顶部和底部区域都为空,如故事板中所示:
Please note the answer herespecifies to use the safe area, but that doesn't work because using it results in the following simulator result where WKWebView is NOT extending to the edges of the screen:
请注意这里的答案指定使用安全区域,但这不起作用,因为使用它会导致以下模拟器结果,其中 WKWebView 没有延伸到屏幕边缘:
采纳答案by Fabrizio Prosperi
Actually I believe the answer is this: to accomplish full screen we should NOT use safe area support. After I unchecked Safe Area Relative Margins and Safe Area Layout Guide on the view in Interface Builder Size Inspector I got the expected result:
其实我相信答案是这样的:为了实现全屏,我们不应该使用安全区域支持。在 Interface Builder Size Inspector 的视图上取消选中 Safe Area Relative Margins 和 Safe Area Layout Guide 后,我得到了预期的结果:
In fact I would say that the idea of Safe Area is that of an area which will for sure not be overlapped by any of the system icons, or rounded borders, full screen is the opposite of it.
事实上,我会说安全区域的想法是一个肯定不会被任何系统图标或圆形边框重叠的区域,全屏则与它相反。