【发布时间】:2023-10-18 21:20:01
【问题描述】:
我的应用程序应该只支持横向模式,所以我配置 info.plist 键以正确的方式获取它。
我的根视图控制器是一个自定义 UINavigationController,我添加到主窗口并实现了
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return ((interfaceOrientation == UIInterfaceOrientationLandscapeLeft) || (interfaceOrientation == UIInterfaceOrientationLandscapeRight));
}
问题在于,在 applicationDidFinishLaunching 之后,interfaceOrientation 始终是 UIInterfaceOrientationLandscapeRight,即使应用程序以 UIInterfaceOrientationLandscapeLeft 方向启动。
结果是启动图像的方向正确,而应用程序是颠倒的。
摇晃设备片刻,使控制器再次按正确方向旋转。
这是一个错误吗?我该如何解决?
【问题讨论】:
标签: ipad rotation launch uiinterfaceorientation launching-application