【问题标题】:Xcode Screen Orientation ProblemsXcode 屏幕方向问题
【发布时间】:2012-03-28 23:56:59
【问题描述】:
我是 Xcode 和 iOS 编程的新手,所以我可能听不懂您告诉我的内容,但还是试试吧。我正在为一个学校项目创建一个应用程序,这将都是横向的。在情节提要中,我添加了许多 ViewControllers 来表示不同的场景,它们都处于横向模式。但是,当我启动模拟器时,在第一个场景之后,它会切换到纵向。我支持的设备方向设置为:横向左,横向右。在情节提要中,在选择 ViewController 的同时,我还将方向更改为横向。
【问题讨论】:
标签:
xcode
xcode-storyboard
【解决方案1】:
观看“Geeky Lemon Development”中的this you tube video。
这将解释如何将您的应用程序设置为横向。
它将设备的启动方向设置为横向。
请记住,在开发要在 iPad 上发布的应用时,您必须支持两种方向(横向和纵向)。
【解决方案2】:
您必须在每个视图控制器中放入以下代码
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return ((interfaceOrientation == UIInterfaceOrientationLandscapeLefr)||(interfaceOrientation == UIInterfaceOrientationLandscapeRight))
}
【解决方案3】:
您是否将方向 (UISupportedInterfaceOrientations) 添加到 plist 中?