Views are Horizontally and Vertically Ambiguous with complex layout

前端 未结 2 1773
-上瘾入骨i
-上瘾入骨i 2021-02-10 09:44

I have a UIViewController on my storyboard that has 2 subviews side-to-side horizontally. I added constraints to fix the leading and trailing edges to a constant (

2条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-10 10:11

    The problem is that many different widths of the two views will satisfy the constraints that you've set up. Here are two examples (I drew the shapes stacked vertically to make it easier to see the overlap example):

    Ambiguity example

    You can add a horizontal space constraint with a value of 0.

    Screenshot

提交回复
热议问题