Saturday, 15 June 2019

How to deal with safe area when using Size Classes?

I just created a simple red view and create 4 constraints for it (top, left, right, bottom). I am trying to make adaptive layout using size classes, but cannot achieve correct layout in "landscape right" orientation:

  1. In portrait mode it's all correct. Bottom, left, right edges to superview's edges, top edge to safe area's top.
  2. In landscape left mode it's all correct. Top, right edges to superviews's edges, left and bottom to safe area's edges.
  3. But in landscape right mode layout is not correct. I expect, that left edge will be equal to superview's left edge, but actually it equal to safe area. Same thing with right edge: I expect that it will be equal to safe area's edge, but actually it equal to superview's edge. How to fix that?

Interface Builder Screenshot Portrait Mode Landscape Left Landscape Right



from How to deal with safe area when using Size Classes?

No comments:

Post a Comment