How to divide UIView in to three even sized subviews horizontally in XCODE?

前端 未结 5 1367
你的背包
你的背包 2021-01-13 23:51

I Have to divide a UIView horizontally into three even sized subviews using Xcode. I tried to use constraints. I got the following result.

5条回答
  •  离开以前
    2021-01-14 00:36

    First, hold "control" key and drag the view to its container view,

    To set view's width equal to container view's width:

    Second, change the multiplier value to 0.3333(means 1/3 width of container):

    Next, set 2nd view's width equal to the 1st one:

    Finally, add 3rd view and apply same set as 2nd one. And remember to add "Same Vertical Center to 1st View" constraint and "xx Leading Space" constraint for 2nd and 3rd view. You will get three same width views fill the container.

提交回复
热议问题