0
votes

I'm working with my project on the storyboard and I have a problem with screen sizes. It looks simple to solve but not for me. I have an imageView, and its width and height are looking good for iPhone 7/7+ screens. But It is not looking good for 5 or SE Screens.

Can I set different width and height for 5 screens? for example, while 7 and 7 pluses run with 200 width and height, iPhone 5 screens will run with 100 width and height. Or is it possible to squeeze the imageView? When I set the constraints imageView it also needs width and height for looking well, but it prevents to squeeze the imageView as well.

1

1 Answers

1
votes

If you want the imageView to squeeze, you shouldn't give it a static width or height in the constraits.

One way to go is to set the leading, trailing, top and bottom constraints for it ==> no need for a width or height constraints.

Another way is to give it a proportional width and height, and this can be done by giving the image view an equal width and equal height constraints to its parent view for example, and then set the multipliers of these constraints to some number, 0.5 for example, this way the image view will always take half of the parent view's width and half of its height.