[英]View stuck in portrait in swift
You should rearrange the view for the landscape. 您应该重新排列景观的视图。
You can do this by code, changing the elements position when detect a rotation , or, the more usual way, using auto-layout , here you have a more detailed guide to how to do it. 您可以通过代码, 在检测到旋转时更改元素位置来执行此操作,或者更常见的方法是使用自动布局 , 在此处,您将获得有关操作方法的更详细的指南。
Another way of solving, is not enabling rotation, you can set in the General options of the project, like this a portrait only mode. 解决的另一种方法是不启用旋转,可以在项目的“常规”选项中进行设置,例如纵向模式。
If you'd like the view to be independent from the orientation change, and resize itself, I would suggest looking into Xcode's Auto-Layout . 如果您希望视图独立于方向变化并自行调整大小,建议您使用Xcode的Auto-Layout 。
If you'd like to disallow orientation changes for your entire application (your view will rotate with the phone), see @UlyssesR 's answer. 如果您想禁止整个应用程序的方向更改(您的视图将随手机一起旋转),请参见@UlyssesR的答案。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.