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.
When we created the View frame, we gave it a width of 200. Why did this not suffice? Why did we also have to change the width to 200 within the Add New Constraints menu?
You will receive a warning stating that position and size of view are ambiguous if you do not. Xcode won't be able to discern the exact size you want it and x,y coordinate it should be at. If you use constraints you must provide all of the necessary constraints so that the device can discern exactly what you want.
Also when you are adding constraints sometimes you want the object to keep a certain width or height no matter what screen size it appears on.
Lets say you have a pop up custom view and it needs to have a height of 100 and width of 200 so that it keeps the same look no matter what screen size. If the views width became shorter the text could become too small or not all words could be shown. For instance Apple requires apps to use a minimum of 11pt font.