0

I am trying to get a rectangular image to scale correctly and I am having trouble fixing the size for smaller screens.

Currently, I have my layout optimized for screen sizes for 6+, 6 and 5.

On the iPhone 4s, things get screwy.

Currently my aspect ration is at 320:257 multiplier

My question is: how do I limit the size from becoming too big, and what would be the optimal solution for this problem?

I guess its best to show pictures:

iPhone 6s

enter image description here

iPhone 5

enter image description here

iPhone 4s

enter image description here

Andy
  • 750
  • 7
  • 23

2 Answers2

0

There are following 2 ways you can resolve your issue.

1) Make IBOutlet of leading and Trailing Constraint and then you can set value of them if you found device is iphone4 or iphone5s.

2)Add all your controls in UIScrollview and set scrollview height dynamically with constraints

Abhishek Sharma
  • 3,283
  • 1
  • 13
  • 22
0

The thing which looks to be problematic to me is that we don't have margin to alter the size of image, as it will impact the aspect ratio. Also, this screen looks like a player and my understanding is that the image is not static and will vary as per album, artist etc (If it is not the case you can re-design this image for IPhone 4 and problem will be solve).

On the other hand you should handle this problem by conrolling Content Hugging Priority and Content Compression Resistance Priority factors for the player controls.

For a quick guide on How to use Content Hugging Priority and Content Compression Resistance Priority and also a Recommended Read.

Hope that helps!

Community
  • 1
  • 1
NeverHopeless
  • 11,077
  • 4
  • 35
  • 56
  • I'm not too worried about having the image perfectly scaled for each image, I'm using aspect fill. But Content Hugging Priority and Content Compression Resistance Priority look like this might be the fix. I'll let you know how it goes. thank you. – Andy Jun 24 '16 at 12:23