简体   繁体   English

包含视图和堆栈视图的设置滚动视图不适合模拟器。 iOS

[英]set scroll view that contains views and stack view doesn't fit on simulator . iOS

Hi every one actually I want to fit this scroll view and stack views on simulator correctly but unfortunately this result not things that I design to view controller and here is my constraints:大家好,实际上我想在模拟器上正确安装这个滚动视图和堆栈视图,但不幸的是,这个结果不是我设计用来查看 controller 的东西,这是我的限制:

在此处输入图像描述

if you have any idea, please share thank you so much.如果您有任何想法,请分享,非常感谢。

here is when I result after the answer:这是我回答后的结果:

在此处输入图像描述

The problem is Stack View.height = height , StackView's height should be automatically driven by it's subviews.问题是Stack View.height = height ,StackView 的高度应该由它的子视图自动驱动。

在此处输入图像描述

After you remove this, you should see another issue that's caused by Stack View.centerY = centerY - you should be able to remove this as well and you should get the expected behavior with rest of the constraints in place.删除它后,您应该会看到另一个由Stack View.centerY = centerY引起的问题 - 您也应该能够删除它,并且您应该在 rest 的约束到位时获得预期的行为。

UPDATE : From the screenshot, it appears that you are using Distribution = Fill Proportionally for the StackView , and it will require a height constraint to distribute it's children proportionally within that height.更新:从屏幕截图中,您似乎正在对StackView使用Distribution = Fill Proportionalally ,并且它需要一个高度约束才能在该高度内按比例分配它的子项。 You should use Distribution = Fill and it will NOT require the height constraint anymore.您应该使用Distribution = Fill并且它不再需要高度约束。

UPDATE 2 : According to the 2nd screenshot, your ScrollView height is not defined.更新 2 :根据第二个屏幕截图,您的ScrollView高度未定义。 You should set something like ScrollView.bottom = superview.bottom which will tell ScrollView how tall it needs to be.您应该设置类似ScrollView.bottom = superview.bottom这将告诉ScrollView它需要多高。 Once your ScrollView height is defined, it should go away.一旦定义了ScrollView的高度,它应该 go 离开。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM