ScrollView 中的视图不遵守约束 [英] Views in ScrollView doesn't respect constraints
本文介绍了ScrollView 中的视图不遵守约束的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我向我的视图控制器添加了一个 ScrollView.然后,我在内部元素和滚动视图本身之间创建了约束,但我不明白为什么我的 yellow 视图没有采用全宽.
I added a ScrollView to my View Controller. Then, I created constraints between my inner elements and the scroll view itself, but I don't understand why my yellow view for example is not taking the full width.
这是我的视图和约束的屏幕截图:
Here is the screenshot of my view and constraints:
有时我会明白,为什么?
And sometimes I get this, why?
当我不使用滚动视图时,一切正常.
When I don't use Scroll View, all works perfectly.
推荐答案
控制从mapView拖拽到外层主View并选择Equal-Widths
Control drag from the mapView to the outer main View and select Equal-Widths
这篇关于ScrollView 中的视图不遵守约束的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文