0
-(void)AnimateBackground
{
//set our background animation
SKAction *Fadein = [SKAction fadeInWithDuration: 2];
SKAction *Fadeout = [SKAction fadeOutWithDuration:1.25];
SKAction *wait2 = [SKAction waitForDuration: 2];
SKAction *wait4 = [SKAction waitForDuration:4];
SKSpriteNode *background_2 = [SKSpriteNode spriteNodeWithImageNamed:@"background2"];
SKAction *sequence2 = [SKAction sequence:@[wait4, Fadein, wait2,Fadeout]];
background_2.position = CGPointMake(screenWidth/2, screenHeight/2);
background_2.alpha = 0;
background_2.size = CGSizeMake((float)screenHeight/2, (float)screenWidth/2);
[self addChild:background_2];
[background_2 runAction:sequence2];
}
-(id)initWithSize:(CGSize)size {
if (self = [super initWithSize:size]) {
/* Setup your scene here */
//init several sizes used in all scene
screenRect = [[UIScreen mainScreen] bounds];
screenHeight = screenRect.size.height;
screenWidth = screenRect.size.width;
[self AnimateBackground];
}
return self;
}
圖像沒有填滿整個屏幕。爲什麼我的圖像不是全屏? xcode(sprite kit)
http://gyazo.com/5dc5e4d7551475f1abac1189ba61bd09
有結果的gyazo。我認爲沒有其他解釋。