([[UIScreen mainScreen] scale] == 2.0) & ([[UIScreen mainScreen] bounds].size.height == 568.0) 不起作用



由于某些原因,这将不起作用,因为我使用iOS 8更新到了最新的xcode。它无法识别CCD_ 1&

([[UIScreen mainScreen] bounds].size.height == 568.0)

// Indicates game is running on iPad
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
    CCLOG(@"Running on iPad");
    // it doesn´t recognize this any more
    if ([[UIScreen mainScreen] scale] == 2.0) {
        CCLOG(@"Running on iPad Retina");
    } else {
        CCLOG(@"Running on iPad 2");
    }      
} else {
    CCLOG(@"Running on iPhone");
    // it doesn´t recognize this any more
    if ([[UIScreen mainScreen] bounds].size.height == 568.0) {
        CCLOG(@"Running on iPhone 5");
    } else {
        CCLOG(@"Running on iPhone 4/4S");
    }
}

您需要添加对iPhone 5的支持。为此,您需要将名为Default-568h@2x.png的启动映像添加到项目中。如果没有此图像,iOS将在兼容模式下运行应用程序,即高度=468

这个问题在的其他问题中较早提出

如何访问地址-电话-5-大屏幕-支持操作系统-应用程序-xcode

如何开发或迁移iPhone 5屏幕分辨率的应用程序?

最新更新