Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS

Swati Rawat
Swati Rawat
3,418 Points

Need help in SpriteKit

Hi, I am trying the sprite kit course here and i tried adding a custom background to the scene. My background image is 1136 X 640 and i am setting it just like in the tutorial

SKSpriteNode *background = [SKSpriteNode spriteNodeWithImageNamed:@"background_1"];

background.position = CGPointMake(CGRectGetMidX(self.frame), CGRectGetMidY(self.frame)); [self addChild:background];

But for some reason my image just doesn't fill the screen. I am running it on simulator (retina, iOS 7.1) and i get the image in the middle of the screen and there is empty space in top and bottom. I don't get it. Can someone help?

1 Answer

Stone Preston
Stone Preston
42,016 Points

double check the dimensions of your image. find your image in the assets category. then open up the utilities pane in xcode. show the attributes inspector. make sure the size is listed as 640 x 1136 pixels. your code looks correct so I think its more likely the image is not sized correctly