Suffix for Retina Images in iPhone 5

后端 未结 3 1203
无人及你
无人及你 2021-01-05 14:34

I have some image files for iPhone 5 size 640x1136, i have previously implemented retina images for iPhone 4 & 4S using @2x suffix, so what will be the suffix for images

相关标签:
3条回答
  • 2021-01-05 14:59

    It’ll still use @2x images where they’re available. There’s a -568h suffix you can use for the launch image, as in Default-568h@2x.png, but that’s currently the only place it’s supported; see Leo’s answer for a way to get that working elsewhere.

    0 讨论(0)
  • 2021-01-05 15:13

    For the iPhone Retina 4-inch (iPhone 5) it's still the @2x suffix because the density is the same as the iPhone Retina (iPhone 4 and 4S). The screen is bigger but have the same density.

    The -568h suffix will work only in for the default image because it's the only place you really need it (just to tell the system that your app have been optimized for this new screen size, and it can stretch your views).

    The naming convention Default-xxx.png is just here to provide the right image while the app is launching but I think it's non sense to try to replicate the same to load other images in imageViews. It's like the Default-(landscape|portrait).png on iPad. You never need this convention to load images yourself.

    The only rule is:

    • @ is for density (2 density exist right now, normal and 2x)
    • ~ is for device (2 different devices exist right now, iphone and ipad)

    To adapt images/imageView on the 4-inch iPhone you should play with your imageView content mode and the autoresizing configurations.

    0 讨论(0)
  • 2021-01-05 15:16

    See my answer here. Some useful macros to help you with dealing with images.

    0 讨论(0)
提交回复
热议问题