Correct Image and Font Scale on different Devices?

后端 未结 8 1977
日久生厌
日久生厌 2021-02-01 05:28

I have a simple view with a text and an Image. I ran this app on iPhone6Plus and iPhone5. Then I made a screenshot of both and enlarged the iPhone5 screenshot such that it match

8条回答
  •  一整个雨季
    2021-02-01 05:58

    The app you are referring to does not correctly support multiple screen sizes. The interface is scaled up to run on the 6 and 6 plus, which is why everything appears the same size.

    Look at the screenshots from your app - the status bar is much smaller on the 6 plus. This is because it is supposed to take up less room on the screen. It's 20 points high on all devices.

    Now look at the screenshot from the weather app - the status bars are the same size. Because the weather app does not support multiple screen sizes, iOS simply takes the smaller interface and scales it up to fill the screen.

    If you want to achieve the same effect (which you shouldn't) then remove the LaunchScreen.xib file and use a launch image instead. But people don't buy larger phoned screens because they want to have the same content, but bigger. That would be achieved more cheaply by simply holding the phone closer to one's face.

    You're supposed to take advantage of larger displays by allowing more content to be shown at once on the screen - more rows of data in a table, more text from a book, more images from a photo library.

    In the case of a weather app the extra space should be used to display more rows of an hourly forecast or something, not just a larger version of a fairly useless icon depicting the type of weather.

    I suspect it is only game support that means supporting larger screens properly is not already a requirement for app store submission. Supporting the 4 inch screen became mandatory quite quickly, you should expect a similar rule to be introduced for the 6 and 6 plus before too long.

    If you want a specific element to always take up 50% of the width of the screen, or a label to always be the same size as an image, then you use autolayout constraints with multipliers. An autolayout constraint is of the basic structure:

    attribute of A = (attribute of B * multiplier) + constant
    

    Most of the time the multiplier is left as one, so you're just saying that this is 20 points to the left of that, or whatever, but you can use the multiplier as well, and say that A is the width of B, multiplied by 2 or 0.5 or whatever you like.

提交回复
热议问题