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! While you're at it, check out some resources Treehouse students have shared here.

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 Build a Game with Sprite Kit Game Loop and Texture Atlas Adding a Title Scene

Trevor Duersch
Trevor Duersch
9,964 Points

How can I get the title screen to fill the full size for my emulator?

I am running my emulator as an iPhone 6 and the title screen wasn't filling the entire screen like it was with Amit's. The question is: "How do I get the title screen to fill the entire screen on my emulator"? I played around with the code, got it working and now I want to share it because I am sure other people will run into this with newer version of XCode and bigger resolution emulators (i.e. iPhone6 or iPhone6 Plus as of 2015).

Under the background.position line, I added another line that says this -

background.size = CGSizeMake(CGRectGetMaxX(self.frame), CGRectGetMaxY(self.frame));

This will grab the size of my frame (no matter the size) and stretch the image to fit. Hope this helps students in the future!

Thanks!

2 Answers

Brayden Kness
Brayden Kness
12,492 Points

Use autolayout constraints to tie the view to the edges of the screen

lovekesh bhagat
lovekesh bhagat
1,572 Points

add this to your code after creating background node

background.size = self.frame.size;

it will fill the screen