@Vadim 的回答稍作调整。没有其他工作,我不想禁用“内容布局指南”。既然苹果启用了它,为什么要禁用它。所以一定有我遗漏的东西或者它是一个错误。
瓦迪姆的回答是:
I stacked with that problem as well. Found a good guide that helped me:
https://useyourloaf.com/blog/scroll-view-layouts-with-interface-builder/
Basically what you need is 9 constraints (assuming you want to scroll only vertically):
1-4: ScrollView to Superview (top, bottom, leading, trailing). Make sure to connect it to parent view and not to safe area.
5-8: Content view to Content Layout guide (top, bottom, leading, trailing)
9: Content view Width equals width to Frame Layout Guide.
一切都好,但它没有工作,
但后来我意识到上面的 6 和 8('内容布局指南'的尾随和底部约束)约束有点奇怪。它们具有正常数值而不是零。就像下图一样。(常量等于滚动视图的宽度和高度)。我将它们更改为零,现在一切正常。
