在XCode11中,跟”XCode8中使用StoryBoard创建Scroll View”有所区别。
虽然,也可以手动编辑 Main.stroyboard, 删除 Safe Area之后,采用跟XCode8一样的方法。
在 XCode11, Object Library默认隐藏, 可以用 Command + Shift + L 快捷键打开
或者 View / ShowLibrary打开
- 创建 Scroll View, 并添加约束
 - 添加View到Scroll View 上
 - 在树形图中,选中View, 按住Ctrl键盘, 拖向 Content Layout Guide
 - 选中View, 拖向 Frame Layout Guide, 在弹出的菜单里,选择Equal Width
 - 为ContentView 设置高度
 - 为Scroll View和Content View 检查约束常量 Constant 是否为0, Multiplier是否为1
 


在弹出的约束菜单里,按住Shift, 同时选中leading / top / trailing / bottom 4个约束


![]()







