Gold Challenge - use auto layout only?

Are you meant todo this just using the auto layout controls ?

Or are you expected todo it programmatically etc ?

Thanks

Setting up constraints programmatically isn’t discussed until Chapter 5, so I don’t think that’s what they had in mind here, but you can do it that way if you want to.

Using auto-layout in Interface Builder, not programmatically. It’s actually a bit harder than it appears at first, at least it took me a while to figure it out.

Thanks, will continue to look with auto layout.

1 Like

Alright. Been at this one for a few hour and it’s kicking my butt. Specifically auto layout is beating me up. I’ve tried adding UIViews between labels. I’ve tried Stacks and have come up dry. Can anyone point me in the right direction. I managed to get close with Stacks between but auto layout was yelling at me the entire time. Thanks.

Start here first: Understanding Auto Layout

2 Likes

Thanks for your link, it helped me get closer to understanding Auto Layout.
My solutions in attach screenshots.

I put every label horizontal in the container, “is really” vertical in the container, and changed the Content Hugging Priority of “degrees Fahrenheit” and “100” to 1 for both horizontal and vertical. “212” and “degrees Celsius” were 8 points from Safe Area. It works in every size of the device, even when I rotate the device. I think this way is faster than creating more “spacer views” in auto layout.

been trying to figure this problem out for hours!

Just play with it. Literally make a frame, set it to auto-layout, put another frame in there, make it a different color so it’s easy to distinguish, and mess with all the padding and sizing controls to see how they behave. Then put all of that in another frame with auto-layout. Try changing orientation from vertical and horizontal. Literally just keep playing with it - I think that’s the best way to learn