remedy
remedy

Reputation: 407

Autolayout in Xcode and keep aspect ratio

I have some trouble with the layout-system in xcode.

Is there a way to accomplish this:

I want to use as much area as possible without distorting the image.

This is the closest I can get. I know the iPhone 3.5" isn't that common anymore but I still want to find a proper solution for this problem.

enter image description here

Upvotes: 0

Views: 775

Answers (1)

siburb
siburb

Reputation: 5017

It looks like you might just need to change your leading and trailing constraints on the UIImageView to >=8 rather than =8. Set a center.X alignment on the UIImageView too.

Then your 1/1 proportions will dictate that the height of the UIImageView will reduce until it can all fit on the screen.

Upvotes: 1

Related Questions