0

我正在尝试使用 xcode 在模拟器上运行我们的应用程序并检查屏幕高度。我正在使用 cocos2d,但我也尝试过苹果方法。

     NSLog(@"HEIGT:%f",[UIScreen mainScreen].bounds.size.height);

      //and also :
     winSize = [[CCDirector sharedDirector] winSize];
     NSLog(@"HEIGT:%f",winSize.Height);

两者都让我在 iPhone5 4 英寸上模拟了 480 的高度。这是为什么 ?我怎么知道这是否真的是 iPhone5?

4

2 回答 2

1

在您的项目中,拍摄一张尺寸为 640*1136 的图像并添加到启动图像的 Retina 图像中,您将获得实际尺寸。您也可以检查打印日志。

2013-04-22 13:10:56.510 test[7526:c07] cocos2d: cocos2d v1.0.1
2013-04-22 13:10:56.511 test[7526:c07] cocos2d: Using Director Type:CCDirectorDisplayLink
2013-04-22 13:10:56.654 test[7526:c07] cocos2d: OS version: 6.1 (0x06010000)
2013-04-22 13:10:56.654 test[7526:c07] cocos2d: GL_VENDOR:   Apple Computer, Inc.
2013-04-22 13:10:56.655 test[7526:c07] cocos2d: GL_RENDERER: Apple Software Renderer
2013-04-22 13:10:56.655 test[7526:c07] cocos2d: GL_VERSION:  OpenGL ES-CM 1.1 APPLE
2013-04-22 13:10:56.655 test[7526:c07] cocos2d: GL_MAX_TEXTURE_SIZE: 4096
2013-04-22 13:10:56.656 test[7526:c07] cocos2d: GL_MAX_MODELVIEW_STACK_DEPTH: 16
2013-04-22 13:10:56.656 test[7526:c07] cocos2d: GL_MAX_SAMPLES: 4
2013-04-22 13:10:56.657 test[7526:c07] cocos2d: GL supports PVRTC: YES
2013-04-22 13:10:56.657 test[7526:c07] cocos2d: GL supports BGRA8888 textures: YES
2013-04-22 13:10:56.657 test[7526:c07] cocos2d: GL supports NPOT textures: YES
2013-04-22 13:10:56.658 test[7526:c07] cocos2d: GL supports discard_framebuffer: YES
2013-04-22 13:10:56.658 test[7526:c07] cocos2d: compiled with NPOT support: NO
2013-04-22 13:10:56.658 test[7526:c07] cocos2d: compiled with VBO support in TextureAtlas : YES
2013-04-22 13:10:56.659 test[7526:c07] cocos2d: compiled with Affine Matrix transformation in CCNode : YES
2013-04-22 13:10:56.659 test[7526:c07] cocos2d: compiled with Profiling Support: NO
2013-04-22 13:10:56.708 test[7526:c07] cocos2d: Frame interval: 1
2013-04-22 13:10:56.709 test[7526:c07] Application windows are expected to have a root view controller at the end of application launch
2013-04-22 13:10:56.709 test[7526:c07] cocos2d: surface size: 320x568

这对我来说很好。

于 2013-04-22T10:15:05.727 回答
0

几天前,我遇到了同样的问题,解决方案是......

为 Retina(4 英寸)设置适当尺寸的启动图像。

在此处输入图像描述

于 2013-04-22T09:41:18.490 回答