我有以下设置,无法正确使用自动布局:
Scroll View, which should take the whole screen
|_ Stack View, which should take the whole size of the Scroll View
|_ View 1 with a predefined height of 200
|_ View 2 with a flexible height defined by content, but minimum 300
|_ View 3 with a predefined height of 500
我已经试过了:
-
滚动视图
-
堆栈视图
-
将顶部、底部、前导和尾随对齐设置为超级视图(滚动视图)
-
将“等宽”设置为“超级视图”(滚动视图)
-
将“等高”设置为“超级视图”(滚动视图),优先级为250
-
堆栈视图中的3个视图
-
定义View1的height=200和View3的height=500
-
定义视图2的高度>=300
我得到:
-
IB中的一个错误:View2的不等式约束模糊性
-
如果我启动并滚动,我会在顶部和底部获得额外的间隔(请参见模拟器屏幕截图中顶部和底部的红色区域)
请看截图: