Ios SpriteKit游戏未填充屏幕
我搜索了一下,却找不到同样的问题。我的背景图像和节点都正确地填满了屏幕,但是在6+的屏幕上,整个游戏在游戏的顶部和底部留下了大约0.5英寸的空间。甚至手机的状态栏也会被按下。在4s版iPhone上,它工作得非常完美。我认为问题就在这里:Ios SpriteKit游戏未填充屏幕,ios,objective-c,sprite-kit,Ios,Objective C,Sprite Kit,我搜索了一下,却找不到同样的问题。我的背景图像和节点都正确地填满了屏幕,但是在6+的屏幕上,整个游戏在游戏的顶部和底部留下了大约0.5英寸的空间。甚至手机的状态栏也会被按下。在4s版iPhone上,它工作得非常完美。我认为问题就在这里: @implementation ViewController - (void)viewWillLayoutSubviews { [super viewWillLayoutSubviews]; // Configure the view.
@implementation ViewController
- (void)viewWillLayoutSubviews
{
[super viewWillLayoutSubviews];
// Configure the view.
SKView * skView = (SKView *)self.view;
skView.showsFPS = YES;
skView.showsNodeCount = YES;
// Create and configure the scene.
SKScene * scene = [MyScene sceneWithSize:skView.bounds.size];
scene.scaleMode = SKSceneScaleModeAspectFill;
// Present the scene.
[skView presentScene:scene];
}
- (BOOL)shouldAutorotate
{
return YES;
}
- (NSUInteger)supportedInterfaceOrientations
{
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
return UIInterfaceOrientationMaskAllButUpsideDown;
} else {
return UIInterfaceOrientationMaskAll;
}
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
将场景大小创建为视图大小,然后设置纵横比填充是没有意义的,而且,您所做的任何事情都可能是MyScene造成的问题,因此您需要发布MyScene很长,只需查看一下,我找不到任何限制大小的内容。那么,我应该如何处理纵横比视图呢?您可以选择其中一个,或者为视图选择一个静态大小,让纵横比填充缩放场景,或者使用。如果您希望场景的大小与视图的大小相同,请调整填充大小添加了6/6+的启动图像,并且似乎解决了问题。您也按照建议进行了调整。现在它也相应地工作了。谢谢。啊,这让你进入了iPhone5模式,不过你现在应该使用xib作为启动屏幕。