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
Ksenia Ustrimova
2,384 PointsxCode 8.0 / Constraints don't work as supposed
Hey, fellow students and mods!
I've got a question: I'm following Pasan's explanation and guiding, but my constraints don't work as they suppose to. While at preview other sizes behave badly, after compilation my initial screen is going everywhere, ignoring all the constraints.
I don't know how to fix it. I've spent a lot of time trying to find out and experiment, but it simply doesn't work.
I will appreciate any help.
Thanks!
1 Answer
Ksenia Ustrimova
2,384 PointsHey Jari,
Thanks for your reply. It happened at Pasan's course on building a playlist app in Objective-C, one of the last videos, where he brings all the pieces of UI together.
As well as I remember, we didn't cover translatesAutoresizingMaskIntoConstraints at all. We've done all the things using auto layout + storyboard. Could you, please, specify, where exactly should I put this property?
Thanks!
Best, Ksenia
Jari Koopman
Python Web Development Techdegree Graduate 29,349 PointsHey Ksenia,
I thought you where talking about a Swift course, you can forget about the translatesAutoresizingMaskIntoConstraints property since that's a Swift thing. I don't have any knowledge about Objective-C so I can't help you any further.
Regards, Jari
Jari Koopman
Python Web Development Techdegree Graduate 29,349 PointsJari Koopman
Python Web Development Techdegree Graduate 29,349 PointsHey Ksenia,
Can you specify in what video/course this happened? This makes it easier for us to help. The fist thing I thought of that you might have forgotten to set the translatesAutoresizingMaskIntoConstraints to false. This can be done like this:
viewName.translatesAutoresizingMaskIntoConstraints = falseHope this helped a bit!
Regards, Jari