故事板ipad仅在横向方向

inf*_*eqd 3 landscape storyboard ipad

我正在创建一个仅支持LANDSDCAPE模式的iPad应用程序.我正在使用故事板.

即使在执行以下操作后,当模拟器以横向模式启动时,应用程序也仅以纵向模式启动.请帮助我如何使应用程序以横向模式启动并始终保持该模式.

  1. shouldautorotate为景观设置为YES
  2. info.plist中的初始界面方向设置为横向
  3. info.plist中支持的界面方向设置为横向
  4. 视图控制器的模拟度量标准设置为推断.

在此先感谢您的帮助.我在网上搜索过但是没有答案.

T.J*_*.J. 6

在模拟公制下,选择"风景".

还要确保在视图控制器实现中使用此方法:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return ((interfaceOrientation == UIInterfaceOrientationLandscapeLeft) || (interfaceOrientation == UIInterfaceOrientationLandscapeRight));
}
Run Code Online (Sandbox Code Playgroud)

  • 是的,谢谢!!!:-)我通过使storyboard类指向UIviewController类的子类来解决问题,其中shouldAutorotateToInterfaceOrientation也被编码.必须为每个实现的ViewController完成此操作.这是我的错误(哎呀!);-(.我认为故事板本身就会完成景观实现,但我想它直到我们将UIViewController子类与它相关联.无论如何我可以直接在没有编码的故事板shouldAutorotateToInterfaceOrientation ???感谢您的回答 (2认同)