我注意到一个我以前没有遇到过的问题 - 在 iPhone 5 和相关设备上,我的游戏在顶部和底部显示黑色区域。
我为它使用标准代码,它显示 skView.bounds.size 即使在大型设备上也是 320x480。
- (void)viewWillLayoutSubviews
{
[super viewWillLayoutSubviews];
SKView * skView = (SKView *)self.view;
skView.showsFPS = YES;
skView.showsNodeCount = YES;
//skView.showsPhysics = YES;
if (!skView.scene) {
NSLog(@"size: %@", NSStringFromCGSize(self.view.frame.size));
SKScene * scene = [MainMenuScene sceneWithSize:skView.bounds.size]; //[MyScene sceneWithSize:skView.bounds.size];
scene.scaleMode = SKSceneScaleModeAspectFill;
[skView presentScene:scene];
}
}
编辑: 它可以正确确定 iPad 尺寸。
EDIT2:改变场景大小不会增加它的高度。我尝试手动设置为 320、568 无济于事。
EDIT3:它在默认 Xcode 项目中显示相同的黑色条纹。这里出了点问题。
截图如下:
最佳答案
不知何故,Xcode 没有为项目提供默认启动图像。添加启动图像后,一切都开始工作了。
关于ios - 如何根据 Sprite Kit 中的设备更改屏幕大小?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22643355/