gpt4 book ai didi

ios - iPhone X 上 UIScrollView 左侧不需要的空白

转载 作者:技术小花猫 更新时间:2023-10-29 11:01:34 25 4
gpt4 key购买 nike

UIScrollView 在除 iPhone X 之外的所有 iPad 或 iPhone 上都可以在左侧没有空白的情况下正常工作。如何删除空白?

我使用 Storyboard。 Bounce On Scroll/Zoom 都被禁用。除了 iPhone X,iPad 或 iPhone 上没有空白区域。我认为这可能与安全区域相关。

enter image description here

最佳答案

此间距来自安全区域,它应用于 UIScrollview 的左/右,作为 iPhone X 横向方向的内容插入,可以使用只读属性 UIScrollview.safeAreaInsets 查看。

以下行可用于在您不需要时摆脱安全区域插入:

UIScrollview.contentInsetAdjustmentBehavior = .never

默认值 UIScrollViewContentInsetAdjustmentBehavior.automatic 包括安全区域布局指南边距作为内容插入。

注意:自动布局约束与 insets 无关,它只是 iOS 11 UIScrollview content insets 调整行为。

关于ios - iPhone X 上 UIScrollView 左侧不需要的空白,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46880256/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com