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 trialBekzod Rakhmatov
7,419 PointsAuto Layout In Objective-C Can Somebody explain it?
1) I was following the constructor but he suddenly change the screen and the sizes did change but he did not say anything about it? It was happening when it was 4:20 s his left margin was 48 and right was 47 but then he clicked 2nd icon and boom these were changed but how they were 32 and 31 ? 2) When I vertical centered it went down to center but on video it was just where it was
1 Answer
Michael Hulet
47,913 PointsThis has to do with the checkbox that he mentions labeled "Constrain to margins". With Interface Builder, you need to select if you want the constraints you set to be relative to the margins that iOS sets or if you want it set to the edges of the screen. iOS automatically selects margins for you to make sure that elements never get pushed up against the edge of screen and look weird, but that isn't always what you want. The default that is set when you bring up that constraints view in Interface Builder is to add constraints relative to the margins, which are closer to the content than the edges of the screen. Thus, the numbers representing the distance of the constraint will be smaller than if the box was unchecked. If you'll notice, Pasan unchecked this box a few seconds earlier in the video, but that checkbox resets every time you open that popover, so even though the numbers were bigger when he closed it at first, they were smaller again when he opened it the next time