IOS Autolayout to set width and height to fit screen size

What constraints should I add to set the width and height proportional to the Superview (in my case it is the UIViewController view) in iOS Autolayout, with Autoresizing we can do as shown in the picture below.

enter image description here

+3


source to share


1 answer


if uiview is in uiviewcontroller.



  • you have to add center horizontally and vertically to container constraint for this uiview.

  • you need to add equal height and equal width for this uiview with your superview.

  • select equal width constraint and width constraint and add a multiplier to this constraint as per your need.
+3


source







All Articles