In autolayout, how can I have view take up half of the screen, regardless of orientation?

后端 未结 5 558
萌比男神i
萌比男神i 2021-01-31 09:41

In portrait mode, I have a tableview on the left-side, and a webview on the right-side. They both take half of the screen. I have autolayout enabled.

But when I rotate t

5条回答
  •  臣服心动
    2021-01-31 09:59

    The constraint system can't read your mind. You must say what you want. Half is half. If you want half, say half. To make a view half the width of its superview, give it a width constraint that has a multiplier of .5 in relation to its superview's width.

提交回复
热议问题