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 (iOS7) Designing your App Adding a Background Image

Jacob McLaws
Jacob McLaws
1,497 Points

Trouble moving the button and label in Xcode

I'm having some trouble moving the button and the label. When I move them on the storyboard, there's a dotted-line red box around where they used to be and when I run the program, they go back to within that dotted line. Is it the frame we set up in the previous lesson? I'm playing with it, but any help would be great. Thanks! https://www.dropbox.com/s/aklp8l0mw3o3xmh/crystal%20ball%20problem.png?dl=0

alt text

3 Answers

Stone Preston
Stone Preston
42,016 Points

youve got some autolayout constraints set. if you select the label and button (select them both by command + clicking them) in your storyboard then press the button that looks like a tie figher ( it looks like this: |-O-| ) at the bottom right there should be an option to clear the constraints. then you can move them around where you want them to be.

after you reposition you will want to reapply some constraints to make them be in the correct position on the different sized iPhone screens.

Jacob McLaws
Jacob McLaws
1,497 Points

Thanks Stone Preston! That fixed it. Out of curiosity, what would those layout constraints be used for normally?

Stone Preston
Stone Preston
42,016 Points

you use auto layout constraints to relatively position views so that your layout looks the same on different sized screens.