让应用在横屏模式下启动

为了让应用从竖屏模式切换为横屏模式,我们得完成三件事情:

1. 更改设备的”Supported Device Orientations”设置;

让应用在横屏模式下启动

2. 让Main.storyboard中的视图控制器中的view使用横屏显示;

让应用在横屏模式下启动

3. 更改ViewController.m中的一行代码,允许视图控制器自动旋转到横屏模式。

让应用在横屏模式下启动

// Returns a Boolean value indicating whether the view controller's contents should auto rotate. In iOS 5 and earlier, the default return value was NO.

- (BOOL)shouldAutorotate {

    return YES;

}

 

现在再点Run按钮,一切应该正常了。

 

 

 

相关文章:

  • 2022-02-11
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-17
  • 2021-12-21
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-04-15
  • 2021-11-23
  • 2022-12-23
  • 2021-12-14
相关资源
相似解决方案