SpriteKit游戏不填充屏幕

时间:2016-04-02 03:29:36

标签: ios objective-c sprite-kit

我搜索过,找不到同样的问题。我的背景图像和节点都正确地填满了屏幕,但是在整个游戏的6倍以上,游戏的顶部和底部留下了大约0.5英寸的空间。甚至手机的状态栏也会被推下。在4s iPhone上它完美运行。这是我认为问题所在的地方:

@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.
}

0 个答案:

没有答案