2014-09-29 88 views
0

由于某些原因,这是行不通的,因为我更新到最新的xcode iOS版8. doesn't认识 ([[UIScreen mainScreen] scale] == 2.0) &([[UIScreen mainScreen] scale] == 2.0)&([[UIScreen mainScreen] bounds] .size.height == 568.0)not working

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

哪些设备你用在兼容模式下的应用程序?您是否在iPad Retina上试过这种'[[UIScreen mainScreen] scale] == 2.0'? – 2014-09-29 05:32:12

+0

不要比较没有epsilon的浮点数;)。不知道,如果这是这里的错误,但你永远不应该这样做。 – HAS 2014-09-29 05:39:21

+0

@WaqasRaja我尝试了所有模拟器... ipad 2,ipad air,ipad retina,iphone 4s,iphone 5,iphone 5s,iphone 6,iphone 6 plus。 当在ipad上运行时,他们都在iphone上运行ipad 2部分 ,他们都去iphone 4/4s部分。 – Chris79 2014-09-29 14:14:35

回答

0

您需要添加为iPhone 5的支持,为此,你需要命名为[email protected]发射图像添加到您的项目。如果没有这种形象的iOS上运行,即高度= 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?

+0

我知道。我已经在使用名为[email protected]的启动图片。我一直在使用,因为iOS 6 ...我的意思是,一切工作正常,直到我从Xcode 5更新到Xcode 6.然后问题开始 – Chris79 2014-09-30 19:20:21

+0

更新:我只是在Xcode 5.1和[[UIScreen mainScreen ]边界] .size.height == 568.0工作正常。 Xcode 6中引起了这个问题,我该如何解决它? – Chris79 2014-10-01 04:41:00

相关问题