I need to design the view like below image and I have tried with fixed heights and also tried compact width and regular height and regular width and compact height but those scenarios did not worked for me.
How can i set View height as percentage of the screen height in Storyboards?
I'm using Xcode 7
Basically you need to act on the multiplier
property of an height equal constraint. To do that while pressing CTRL, drag from the view to its superview and select equal heights constraint
, later edit this constraint in Size Inspector by setting its multiplier
the desired value can be expressed also as 1:25, 1/25, 0,025. If it working on the contrary just reverse items as in the picture.
You can simply set the height of each one as a ratio of the UI height, 15% height would be;
.frame(width: UIScreen.main.bounds.width, height: UIScreen.main.bounds.height * 0.15)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With