ios - ScrollView 不滚动我的所有内容

标签 ios xcode autolayout

我正在使用一个scrollView,并且在它的内部使用了一个 View 。

enter image description here

我设置的尺寸是这样的:

enter image description here


enter image description here


enter image description here


enter image description here

我认为我的视野高度始终是959。 但是当我将高度从 959 更改为 2000 时,我看到一条橙色线,当我使用 Editor->resolve Auto..->updateframes 时,我的自定义高度返回到 959。

即使当我设置距引脚的高度时,我也会看到红线:

enter image description here

enter image description here

我希望所有内容都滚动。内容高度为2000。

最佳答案

您通过以下方式检查:

ScrollView 约束:

顶部设置为您的 super View

底部设置为您的 super View

领先设置为您的 super View

尾随设置为您的 super View

将一个UIView放入 ScrollView 中并应用以下约束(等于相同的Scrollview宽度高度)

设置top为scrollview

设置bottom为scrollview

前导设置为 ScrollView

尾随设置为 ScrollView

不要忘记将 ScrollView 设置为等宽

然后添加您想要的所有 UIElement。 考虑如下:

标签1---->给UIView设置必要的约束

标签2---->给UIView设置必要的约束

标签3---->给UIView设置必要的约束

lable 4---->给UIView设置必要的约束

lable 5----> 给 UIView 设置必要的约束并且你给 UIView Bottom 约束

然后滚动将自动工作。不要像这样调整值。如果您想要更大的屏幕,请将 View Controller 模拟尺寸更改为自由形式,然后您可以调整您喜欢的高度并基于此放置 ScrollView 。

关于ios - ScrollView 不滚动我的所有内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42712113/

相关文章:

iphone - 如何在 Library 目录中创建一个私有(private)目录并为其指定应用程序包 ID 的名称?

Xcode 查找调用者函数

ios - 没有模拟器出现在我的 Watchkit 目标下

ios - 根据 `UIView` `UILabel` 中的文本更改 `UITableViewCell` 宽度

ios - 自动布局和 "Hide bottom bar when pushed"

ios - UIView 动画在 iOS 8 中无法正常工作?

ios - 如何将 LongPressGestureRecognizer 添加到禁用的 TextField

ios - 从一个 View Controller 传递字符串并将其显示在 ios 的 UITextView 中

ios - 访问类函数时 Swift 中的预期声明错误

ios - Xcode - 如何在 Storyboard中切换 View