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
iPhone 5
iPhone 4s
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
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!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.