Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我设计的 ViewController 包括 1 个 UIView 和 1 个按钮,但是当我在 Emulatore 中部署时,它与我在故事板文件中看到的不同。
这是您拥有的自动布局约束的结果。故事板中的默认屏幕尺寸适用于 iPhone 5,但默认模拟器是 iPhone 4 尺寸,因此通过与屏幕顶部和底部的固定距离,必须压缩视图以满足约束。
要解决这个问题,你应该给视图一个固定的高度(从菜单,编辑器 --> 引脚 --> 高度),然后删除底部约束。
您还可以使用距离到超级视图到顶部,还可以设置 virw 高度常数。你不需要底部约束