iphone - 横向模式仅适用于 iPhone 或 iPad

标签 iphone objective-c cocoa-touch uikit ipad

我想创建一个不使用纵向模式的应用程序。

我不确定是否需要编辑 plist 或除 plist 之外还有代码

最佳答案

Code found here

Launching in Landscape Mode

Applications in iPhone OS normally launch in portrait mode to match the orientation of the Home screen. If you have an application that runs in both portrait and landscape modes, your application should always launch in portrait mode initially and then let its view controllers rotate the interface as needed based on the device’s orientation. If your application runs in landscape mode only, however, you must perform the following steps to make it launch in a landscape orientation initially.

  • In your application’s Info.plist file, add the UIInterfaceOrientation
    key and set its value to the
    landscape mode. For landscape
    orientations, you can set the value
    of this key to
    UIInterfaceOrientationLandscapeLeft
    or
    UIInterfaceOrientationLandscapeRight.

  • Lay out your views in landscape mode and make sure that their autoresizing options are set correctly.

  • Override your view controller’s shouldAutorotateToInterfaceOrientation: method and return YES only for the
    desired landscape orientation and NO
    for portrait orientations.

关于iphone - 横向模式仅适用于 iPhone 或 iPad,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2647786/

相关文章:

javascript - YouTube 事件嵌入到 Mobile Safari、iPhone(停止时回调)

iphone - 如何在 iPhone/iPad 应用程序中支持西里尔字母?

iphone - 在通用应用程序中使用 UIPopoverController

iphone - 在 iOS 7 中使用 MAC 地址的问题

iphone - 从 AppDelegate 调用 presentModalViewController 不起作用

objective-c - UITextField "value changed"字段更新时未触发

iphone - 附加 XCode 调试器

iphone - 使用加速度计和陀螺仪的 6DOF

objective-c - 找不到实例方法 - 对于应用程序委托(delegate)属性

ios - 在IOS中使用NSSortDescriptor对数组(NSString + Number)进行排序?