Objective c SpriteKit iPhone 6模拟器显示背景图像填充

Objective c SpriteKit iPhone 6模拟器显示背景图像填充,objective-c,ios8,sprite-kit,Objective C,Ios8,Sprite Kit,大家好,我正在学习SpriteKit iOS Xcode 6,并尝试使用以下代码从sprite.atlas添加一个image640 X 1136作为背景 self.atlas = [SKTextureAtlas atlasNamed:@"sprite"]; // set background SKSpriteNode * background = [SKSpriteNode spriteNodeWithTexture:[self.atlas textureNamed:@

大家好,我正在学习SpriteKit iOS Xcode 6,并尝试使用以下代码从sprite.atlas添加一个image640 X 1136作为背景

    self.atlas = [SKTextureAtlas atlasNamed:@"sprite"];

    // set background
    SKSpriteNode * background = [SKSpriteNode spriteNodeWithTexture:[self.atlas textureNamed:@"background"]];
    background.position = CGPointMake(CGRectGetMidX(self.frame), CGRectGetMidY(self.frame));

    [self addChild: background];
但问题是在iPhone6模拟器中,整个图像都有白色边框填充,但在iPhone4S模拟器中看起来很好

你能告诉我如何将图像扩展到全屏吗。是否有任何设置需要添加


提前谢谢你

iPhone 6的屏幕大小是750×1334像素,如果你想让它填满整个屏幕,那么这应该是背景的大小。您应该为iPhone 6+添加更大的版本


看看:

这个问题已经在这里得到了回答:您可以通过更改ViewController.m的viewDidLoad函数中的aspect fill/fit/etc模式来修改布局。