Ios cocos2d v3.0中iphone 3.5英寸和4英寸的场景大小

Ios cocos2d v3.0中iphone 3.5英寸和4英寸的场景大小,ios,cocos2d-iphone,Ios,Cocos2d Iphone,我对场景的大小有一些问题。我的屏幕总是一样大,因此我无法确定屏幕大小,我总是在3.5英寸和4英寸的iphone上看到“320x480”。如何开始获取屏幕尺寸而不是“320x480”?提前谢谢您试过了吗 [[UIScreen mainScreen] bounds].size ? 检查尺寸的高度和宽度时,对于3.5英寸的屏幕应返回320x480,对于4英寸的屏幕应返回320x568。我尝试过,但我总是得到320x480,可能cocos2d设置中的某个地方指示屏幕的尺寸为320x480?但我查看了主

我对场景的大小有一些问题。我的屏幕总是一样大,因此我无法确定屏幕大小,我总是在3.5英寸和4英寸的iphone上看到“320x480”。如何开始获取屏幕尺寸而不是“320x480”?提前谢谢

您试过了吗

[[UIScreen mainScreen] bounds].size
?


检查尺寸的高度和宽度时,对于3.5英寸的屏幕应返回320x480,对于4英寸的屏幕应返回320x568。

我尝试过,但我总是得到320x480,可能cocos2d设置中的某个地方指示屏幕的尺寸为320x480?但我查看了主设置,找到了固定尺寸,并将其更改为灵活,但一切都没有改变。CCSetupScreenMode:CCScreenModeFlexible这是一个非常好的主意,但是我从3.5英寸和4英寸的屏幕上得到了320x480。。。
use this for checking whether the device is iPhone 4 or 3.5 inch,then get y position or height for controller or view


+(BOOL)isDeviceiPhone5
{
    BOOL iPhone5 = FALSE;

    CGRect screenBounds = [[UIScreen mainScreen] bounds];
    if (screenBounds.size.height == 568) {
        // code for 4-inch screen
        iPhone5 = TRUE;
    }
    else
    {
        iPhone5 = FALSE;
        // code for 3.5-inch screen
    }
    return iPhone5;

}


+(CGRect )getFrameFor_iPhone4_height:(CGRect)frame
{
    frame.size.height = frame.size.height - 87.0;
    return frame;
}
+(CGRect )getFrameFor_iPhone4_yPos:(CGRect)frame
{
    frame.origin.y = frame.origin.y - 87.0;
    return frame;
}