Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set subview height relative to parent view in Storyboard

I have a UIImageView in a UIViewController's view. What I want is to set it's height 1/3rd that of the view no matter what the screen size is. I of course know how to do this from code. But how to accomplish this using Storyboard/Interface builder only ?

like image 683
Nitish Avatar asked Sep 26 '16 05:09

Nitish


1 Answers

Add a height constraint whose multiplier value is 1/3 so the image view's height will be one third of its superview's height.

enter image description here

--

Here is how it looks with different device sizes:

Bad rendering on small screen    Bad rendering on small screen     Bad rendering on small screen    

like image 74
Ozgur Vatansever Avatar answered Oct 17 '22 03:10

Ozgur Vatansever