0

シミュレーターでアプリを実行し、画面の高さを確認するために xcode を試しています。私は cocos2d を使用していますが、Apple メソッドも試しました。

     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 のイメージを 1 つ取り、起動イメージの 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 に答える