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 Simple iPhone App with Swift Improving Our User Interface Adapting Our Content

Align issue

Hi, I got a problem with my Xcode, In my editor area all the items in the right position, I mean centre of the screen, but when I run the simulator, it seems little bit left. Is it Xcode bug or something else?

Here is the screenshots: https://app.box.com/s/4bps2zviv9h2r1qtyqbux69wkxqcovln https://app.box.com/s/2n0y7of21e4gj9t58stfirid8g0jmajr

1 Answer

Stephen McMillan
.a{fill-rule:evenodd;}techdegree seal-36
Stephen McMillan
iOS Development with Swift Techdegree Graduate 33,994 Points

It looks like your using the 4 inch screen size in Xcode when positioning items. However when your running on the iPhone 6 simulator (4.7 inch) because its a bigger screen the items look left aligned. If you look at the current view in your storyboard and imagine extra screen space being added to the right you should be able to understand why this is happening when running on larger devices...?

Adding auto layout constraints will make sure that the items are positioned centre on all devices regardless of the screen size. If your following the videos, I'm pretty certain Pasan adds these constraints.

Good luck. :)