Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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!


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