【问题标题】:UIUserInterfaceIdiomPhone is for iPod touch too?UIUserInterfaceIdiomPhone 也适用于 iPod touch?
【发布时间】:2012-08-26 10:16:33
【问题描述】:

对不起,我的问题很愚蠢,但我在任何地方都没有找到好的答案。

如果我检查 UIUserInterfaceIdiomPhone,iPhone 和 iPod touch 的结果都是 YES?

我的意思是:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
        return (interfaceOrientation == UIInterfaceOrientationPortrait);
    }
    return YES;
}

仅对 iPad 返回 YES,对 iPhone 和 iPod 返回纵向?

我开发了一个 iPhone 应用程序,现在我将其更改为通用的。它几乎完成了,我不想改变我所有的“如果”。 (我自己没有真正的 iPod touch 来测试它)。

谢谢, 最大

【问题讨论】:

    标签: iphone ios ipad ipod-touch


    【解决方案1】:

    是的,iPod touch 在这方面被视为 iPhone。

    【讨论】:

      【解决方案2】:

      这个宏主要用于区分 iPad 和 iPhone 或 iPod 的屏幕大小。
      由于 iPhone 和 iPod 具有相同的屏幕尺寸,因此都属于电话类别。 所以对于 iPhone 和 iPod,UIUserInterfaceIdiomPhoneYES
      并且是 NO 对于 iPad。
      更多内容请阅读apple docs

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2011-02-09
        • 1970-01-01
        • 2010-09-13
        • 2011-05-15
        • 2011-08-23
        • 1970-01-01
        • 1970-01-01
        • 2011-02-11
        相关资源
        最近更新 更多