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

Auto Layout misplaced views Error in Ribbit App

Hi, I've been following the tutorial for the all the iOS Projects (absolutely fantastic by the way) and I've hit a problem which I can't seem to figure out. I'm on the Auto-Layout section and trying to position the "Don't have an account" and Sign up button and along with the error described in the video I'm also getting a "Misplaced Views" error On Button and Label. Saying.. "Expected y=-44 Actual y=436". I can see 2 dotted boxes showing just outside the Visible view area. I'm not entirely sure what to do.

4 Answers

Ok I think I've kinda figured out what's going on. It seems like the Button and label were being moved inside the UIScrollView. I moved them outside the scroll view and when that happens they get repositioned to the centre of the screen... However when I try to move the back to where they're supposed to be they seem to become children of UIScrollView again. What's going on? :)

that happened to me as well. You justt have to keep trying to position them above the scroll view. Use the document outline to position them, dont do it directly on the storyboard.

And we have a winner :) Cheers. So just to re-cap. If anyone is having misplaced view errors there's a chance that the Label and the Button ended up inside the UIScrollView. Use the document outline view to move them out of the ScrollView and then use the Size inspector to manually position the items so they don't get put back in.

Id suggest going back through the video again and making sure you have the constraints set right for that button and label. You may have forgotten to enable the constraint or something or typed the wrong value.

Yeah. I'm going to try a couple more times. I've already tried it twice. I can make the the red errors disappear not the amber ones that are showing up. I've managed to make the all values match up to the video too.

Bobby, I realize that it has been almost a year ago since you asked and figured out this question, but it just came in handy for me! I could not figure out why I was having the same problem. I did what you stated in your last comment and it worked flawlessly. Thanks, man!