我正在尝试使用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呢?
答案 0 :(得分: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
这对我来说很好。
答案 1 :(得分:0)
几天前,我遇到了同样的问题,解决方案就是......
为Retina(4英寸)设置适当大小的启动图像。