autolayout – make height of view relative to half superview height

Storyboard solution where you can set exact ratio between any views:

Set height equality constraint

Now:

Edit constraint's multiplier

PROFIT!!!

Result

P.S. Also note that this method works with views on different nesting levels and (obviously) applicable for width

P.P.S. sometimes it might be helpful to “reverse first and second item” of constraint or set reverse multiplier (for example 2 instead of 0.5) (but these methods are not helpful if you don’t understand how views relate between each other).

Leave a Comment