iPhone/iPad 通用应用方向

标签 iphone ipad orientation

我正在开发通用应用程序。现在我想设置这两种方式的方向:当应用程序在 iPhone 上启动时,它会以纵向模式打开;当应用程序在 iPad 上启动时,它会以横向模式打开。

可能吗?

最佳答案

- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad && UIInterfaceOrientationIsLandscape(interfaceOrientation)) {
        return YES;
    } else if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone && UIInterfaceOrientationIsPortrait(interfaceOrientation)) {
        return YES;
    }

    return NO;
}

关于iPhone/iPad 通用应用方向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5094687/

相关文章:

iphone - 如何从EAGLView获取UIImage?

iphone - 使用 Soundcloud API OAuth2 时出现 401 错误代码

iphone - 如何在xcode中拖放文件?

ios - UITextField 文本在编辑时向左移动 1px

android - 在三星机器人上拍摄的图库图像即使是纵向拍摄也始终是横向的

android - 如何在布局/绘图发生之前更改屏幕方向?

iphone - 如何在 HTML 中显示表情符号字符

iphone - 基于网络连接发送电子邮件或短信(慢/快)

iphone - 美国 iPhone 是否具有 AVSpeechSynthesizer 的英国语音? (要测试的示例代码)

java - 相机方向改变