([[UIScreen mainScreen] scale] == 2.0)& ([[UIScreen mainScreen] bounds] .size.height == 568.0)无效

时间:2014-09-29 04:59:32

标签: cocos2d-iphone xcode5 ios8 xcode6

出于某种原因,由于我使用iOS 8更新到最新的xcode,因此无法识别 ([[UIScreen mainScreen] scale] == 2.0)&

([[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");
    }
}

1 个答案:

答案 0 :(得分:0)

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

此问题早先在其他问题中提出

how-to-add-iphone-5-large-screen-support-to-ios-apps-in-xcode

How to develop or migrate apps for iPhone 5 screen resolution?