-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可以正常工作,但我得到的静态ContentView为1000,这不是我的目标,因为我的ContentView获得了动态内容,所以它应该是内容所需的高度.
如果删除ContentView的高度约束,Xcode会显示:
Missing Constraints:
ScrollView need constraints for: Y position or height
ScrollView实际上固定在顶部和底部,所以我不知道为什么Xcode want是ScrollView的高度限制...
当我希望ContentView的高度是内容所需的高度时,正确的方法是什么?