Search code examples
swiftconstraints

How to use constraints in landscape mode


In portrait mode, my screen is completely normal when I adjust the constrains. But when I flip, my top view and bottom view become almost equal. How do I adjust them to look like in portrait mode.

enter image description here

enter image description here

I tried looking on YouTube, but there is no similar content to what I was looking for.


Solution

  • i think your problem is related to constant value for top constraint. indeed, I see contraint is ALWAYS 198, and 198 both landscape and portrait.

    try to set constraint with:

    1. constant 0
    2. multiplier as you want.

    enter image description hereenter image description here

    enter image description here