Veer
Veer

Reputation: 1383

How to make iOS ImageView full match window?

enter image description here

I am new in iOS , I am an android developer self-learing iOS just for fun. As you can see from the picture , I want to make my ImageView full-displayed in the window in different inch iPhone. If you are an android developer, you may know what I mean is how to make ImageView match_parent in both width and height?

Upvotes: 0

Views: 77

Answers (2)

Ulysses
Ulysses

Reputation: 2317

You must set the UIImageView Constraints, like this to adjust in the full screen, 0 spacing in all sizes, and click in Add 4 Constraints

enter image description here

After that, you must check in the UIImageView settings the mode to Aspect Fit, so it will keep the aspect ratio of your image.

I Took the image from your print, here is the expected final result.

enter image description here

Upvotes: 1

matt
matt

Reputation: 535850

Pin the image view on all four sides to its superview via constraints with a constant of zero. Now configure the image view's content mode so that it doesn't distort the image, but rather keeps its aspect ratio (there are two ways to do this, and I don't know what one you want, so you will have to experiment).

Upvotes: 1

Related Questions