gpt4 book ai didi

swift - 没有自动布局的 XCODE 8 中 UIScrollView 的奇怪行为

转载 作者:搜寻专家 更新时间:2023-10-31 21:47:24 25 4
gpt4 key购买 nike

我刚刚将我的 xcode 从 7.3 更新到 8,并面临所有 UISrollview 的一些奇怪行为。在 ScrollView 内的设备 subview 中进行测试时, ScrollView 与屏幕中心对齐,但在 Storyboard 中,它的排列非常好。对于这种意外行为,我没有任何线索。请帮助..

最佳答案

您必须在名为 (scrollContainerVw) 的 ScrollView 中再添加一个 subview ,并设置以下引脚: enter image description here enter image description here用于 ScrollView 和 subview 。

如果要支持多屏请在view did load中添加如下代码:

    self.scrollVw.frame.size.width = self.view.frame.size.width
self.scrollVw.frame.size.height = self.view.frame.size.height
self.scrollContainerVw.frame.size.width = self.view.frame.size.width
self.scrollContainerVw.frame.size.height = self.view.frame.size.height

关于swift - 没有自动布局的 XCODE 8 中 UIScrollView 的奇怪行为,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39511265/

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