【问题标题】:How to detect iPhone 5 screen in iOS 8 [closed]如何在 iOS 8 中检测 iPhone 5 屏幕 [关闭]
【发布时间】:2015-01-19 07:55:13
【问题描述】:

我有一款适用于 iPhone 4 和 iPhone 5 屏幕的游戏。在 iOS 7 上一切正常,但是 在 iOS8 上,当我使用 iOS 8 为 iPhone 5 构建项目时,显示 iphone4.xib 带有黑色条纹,这意味着它没有检测到 iPhone 5 屏幕。如何解决这个问题?

【问题讨论】:

    标签: ios ios8 xib screen-resolution iphone-5


    【解决方案1】:

    我的理解是这就是你想要做的

    您需要添加一个 LaunchScreen.xib 以使您的应用与 iOS 8 兼容 如果您支持 iOS

    这是 Apple 建议添加 LaunchScreen.xib https://developer.apple.com/library/ios/documentation/IDEs/Conceptual/AppDistributionGuide/ConfiguringYourApp/ConfiguringYourApp.html#//apple_ref/doc/uid/TP40012582-CH28-SW4 的方式

    【讨论】:

    • 不,你没有正确理解。我有适用于 iphone 4 和 iphone 5 屏幕的 xib。我检查正在运行的内容 [VSUtils isIPhone5Stsreensch] 并启动相应的 xib。在 iOS 7 上一切正常,但在 iOS8 上,当我使用 iOS 8 为 iPhone 5 构建项目时,显示 iphone4.xib 带有黑色条纹。
    • 如何检查应用在哪个设备/模拟器上运行?
    【解决方案2】:

    我解决了这个问题。

    在此之前,我通过 [VSUtils isIPhone5Screen] 检查了应用程序在哪个设备上运行。 在 iOS8 上它不起作用。

    我已经这样做了:

    #define SYSTEM_VERSION_EQUAL_TO(v)                  ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame)
    #define SYSTEM_VERSION_GREATER_THAN(v)              ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending)
    #define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v)  ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
    #define SYSTEM_VERSION_LESS_THAN(v)                 ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
    #define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v)     ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending)
    
    if(SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0")){ 
       ...
    }
    

    【讨论】:

    • 您应该编辑您的问题。你的问题不清楚。另外,提供[VSUtils isIPhone5Stsreensch] Good 现在可以使用的代码
    猜你喜欢
    • 1970-01-01
    • 2012-09-14
    • 2012-01-02
    • 2011-09-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多