【发布时间】:2023-12-04 18:48:01
【问题描述】:
我创建了一个视图控制器并将视图的方向设置为 XCode 4.2 (Interface Builder) 中的横向。但是,当我添加视图时,视图以纵向显示。我已经在所有视图控制器中覆盖了 ShouldAutorotateToInterfaceOrientation 以返回 true,并且我尝试使用以下代码手动旋转视图:
this.View.Transform.Rotate (3.14f * .5f);
我也尝试将框架设置为横向框架(即 480 X 320),尽管视图的框架已正确设置。
澄清一下,我的绝大多数观点都是纵向的。我想以横向加载横向视图,无论设备实际处于什么方向。这可能吗?如果是这样,我错过了什么?
提前感谢您在此问题上的任何帮助!
更新:我注意到 ShouldAutorotateToInterfaceOrientation 仅在加载视图时调用一次。旋转设备时不会调用它。这是正常行为吗?
【问题讨论】:
-
当你说你已经覆盖了 ShouldAutorotateToInterfaceOrientation 以返回 true...你的意思是你正在返回以下内容吗?: return toInterfaceOrientation == UIInterfaceOrientation.LandscapeLeft || toInterfaceOrientation == UIInterfaceOrientation.LandscapeRight;
标签: ios xamarin.ios