你如何使用isWidescreenEnabled()?

时间:2012-10-08 15:53:51

标签: kobold2d

release notes of Kobold2D v2.0.4中,它说:

  

添加了C函数isWidescreenEnabled()来报告app是否正在运行   具有宽屏“启用”的宽屏设备(即何时   Default-568h@2x.png包含在项目中)

除了安装Xcode 4.5和Kobold2D v2.0.4以及在项目中包含Default-568h@2x.png之外,我还需要做什么才能使用isWidescreenEnabled函数?

2 个答案:

答案 0 :(得分:0)

您不需要使用isWidescreenEnabled()。您可以使用winSize并查找高度为568(对于纵向UI;对于横向UI,请查找宽度为568)。这是一些示例代码(用于纵向UI):

CGSize screenSize = [CCDirector sharedDirector].winSize;
if (screenSize.height == 568) {
  // You have a device with a 4" retina display; do something special
}

答案 1 :(得分:0)

您可以像这样使用isWideScreenEnabled:

if (isWideScreenEnabled())
{
    // widescreen-specific code here ...
}

它不需要Xcode 4.5或Default-568h@2x.png。它基于this question中的答案和评论。

相关问题