Module Bonus Lesson 2 - Constraint Issues

Code Crew:

I just finished the Bonus Lesson 2 video. I understand it’s an older version of Xcode, I’ve already figured out the whole “setting constraints individually to make it fit” thing, but towards the end, we were going through different devices, and you briefly mentioned something about what we “could have done” when it came to the notches in landscape mode on iPhone X and above, and the text being too close to the notch. You said maybe you’d change it from 20 points to something higher, but when I did that, it changed where it was for the Portrait Mode as well.

Is there a way to adjust the constraints for the text in Landscape Mode to stay in the safe area? And not affect the positioning of it in Portrait Mode?


Yes!! Look into “auto layout”
You can add constraints based on which orientation and width/height constraints are of the phone

At the bottom of a storyboard you see, for example, iPhone 11 wC and wR this is indicating portrait mode. I think it stands for “compact and regular.”

Basically you can add certain constraints depending on the phone’s orientation