Check out the screenshots below. Your goal is to recreate the interface, using autolayout anchors in code. You'll need to make a project from scratch for this lab.
Here are some layout details:
- The left button is 10 pts from the left of the screen, and the right is 10 pts from the right. Both are 10 pts from the bottom. Use the default width and height for the buttons.
- There is one
UITextView
that is 20 pts from the top, 10 pts from the left, 10 pts from the right, and 20 pts from the top of theUIButton
s.
After you've set things up, make sure your layout looks correct in both landscape and portrait. Ah, the magic of autolayout!
- In portrait mode, leave the padding between the
UIButton
and theUITextField
at 20 pts. In landscape, decrease it 10 pts. Hint: you can listen for a rotation event and examine the new size class. Check out Joe's blog post for details. - On an iPhone 6 or 6+, increase make the padding between the
UIButton
and theUITextField
to be 30 pts. Hint: more size classes!
View AutoLayout-TextView on Learn.co and start learning to code for free.