【发布时间】:2016-06-08 02:01:00
【问题描述】:
-ViewController
--View
---ScrollView (Top,Bottom,Leading,Trailing spaces to superview set to 0)
----ContentView (Top,Bottom,Leading,Trailing spaces to superview set to 0, Width equals with View (ViewController's child))
-----Label1
-----etc...
如果我为我的内容视图设置了特定的高度约束(例如 1000),则 ScrollView 工作正常,但我得到了 1000 的静态 ContentView,这不是我的目标,因为我的 contentView 有动态内容,所以它应该是内容需要的高度。
如果我删除 ContentView 的高度限制,Xcode 会说:
Missing Constraints:
ScrollView need constraints for: Y position or height
ScrollView 实际上是固定在顶部和底部的,所以我不知道为什么 Xcode 想要对 ScrollView 设置高度限制...
当我希望 ContentView 高度成为内容所需的高度时,正确的方法是什么?
【问题讨论】:
标签: ios objective-c autolayout storyboard scrollview