-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...
Run Code Online (Sandbox Code Playgroud)
如果我为我的内容视图设置了一个特定的高度约束(例如1000),ScrollView工作正常,但我有一个1000的静态ContentView,这不是我的目标,因为我的contentView获得了动态内容,所以应该是内容的高度需要.
如果我删除了ContentView的高度约束,Xcode说:
Missing Constraints:
ScrollView need constraints for: Y position or height
Run Code Online (Sandbox Code Playgroud)
ScrollView实际上是固定在顶部和底部,所以我不知道为什么Xcode想要ScrollView的高度约束...
当我希望ContentView高度达到内容所需的高度时,正确的方法是怎样的?