简体   繁体   English

约束在模拟器中正常工作,但未在 Xcode 编辑器中应用

[英]Constraints working correctly in simulator, but not applied in Xcode editor

I am writing my first app using Xcode, and I've been working with constraints in a vertical stack view in main.storyboard.我正在使用 Xcode 编写我的第一个应用程序,并且我一直在 main.storyboard 的垂直堆栈视图中处理约束。 I applied constraints to center my stack view horizontally and vertically.我应用约束以水平和垂直居中堆栈视图。 I can see that the constraints are applied, and when I run the app in the simulator, the constraints are working as I intended.我可以看到应用了约束,当我在模拟器中运行应用程序时,约束按我的预期工作。 Back in main.storyboard, the constraints are not applied, so everything looks wonky until I run it in the simulator.回到 main.storyboard,没有应用约束,所以在我在模拟器中运行之前,一切看起来都很不稳定。

Is this just something I have to live with, or is there a way to "apply" the constraints so I can sort of preview them without actually having to run the simulator every time I add a new constraint to make sure it is working the way I wanted it to?这只是我必须忍受的事情,还是有一种方法可以“应用”约束,这样我就可以在每次添加新约束以确保它正常工作时实际运行模拟器而无需实际运行模拟器我想要它?

Select Editor > Update Frames , or click the little round arrow icon at the bottom right: Select Editor > Update Frames ,或点击右下角的小圆箭头图标:

更新帧按钮

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

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