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

后端 未结 5 562
萌比男神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条回答
  •  旧时难觅i
    2021-01-31 10:09

    Create a UIView in XIB or Storyboard

    1. Set top and left constraints
    2. Set a height constraint
    3. Set width constraint to equal width of the super view *Important
    4. Edit the width of the constraint by converting it to decimal

    1. Set the decimal to the width you'd like (In my case 0.5 or half)

提交回复
热议问题