iphone 6 vs iphone 5 image Naming Convention [英] iphone 6 vs iphone 5 image Naming Convention

查看:84
本文介绍了iphone 6 vs iphone 5 image Naming Convention的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用ios 8.x兼容性在Xcode 6中为 MyimageView 设置相应的 MYimage.png

  MyimageView setImage:[UIImage imageNamed:@MYimage.png]; 

在参考资料中,我有以下分辨率的图像:

  MYimage.png  -  320 * 480 

MYimage@2x.png--640*960

MYimage -568h@2x.png--640*1136

MYimage-375h@2x.png--750*1334

MYimage-736h@3x.png--1242* 2208

对于iPhone 4s,它显示: MYimage@2x.png [对]



对于iPhone 5s,它显示: MYimage@2x.png [错误]



对于iPhone 6,它显示: MYimage@2x.png [错误]



对于iPhone 6 +,它显示: MYimage@2x.png [错误]



但在重命名图像后,如下所述:

  MYimage.png  -  320 * 480 

MYimage@2x.png--640*960

MYimage-568h@2x.png--640*1136

MYimage-375h@2x.png--750 * 1334

MYimage@3x.png--1242*2208

For iPhone 4s,显示: MYimage@2x.png [右]



对于iPhone 5s,它显示: MYimage@2x.png [错误]



对于iPhone 6,它显示: MYimage@2x.png [错误]



适用于iPhone 6 +,它显示: MYimage@3x.png [右]



那么,实施的陈述格式是什么?



注意:在链接等等。

解决方案

iOS仅支持发布图像的大小表示法,例如页面描述了3.5的使用情况, 4,iPad格式为 Default-568h@2x.png 等。



你是什么实际上只能支持@ 2x和@ 3x(参见这里)解释了为什么在你看到它的每个设备上它只能获得@ 2x和@ 3x png。



最后, MYimage@Xx.png--w*h 也不是有效的大小表示;当您引用名为 MYimage.png 的图像时,系统将不会自动读取这些文件;最多可以 MYimage@2x.png MYimage@3x.png



回答以下问题:



iPhone 6和iPhone 5 渲染 at相同的像素密度。 UI元素应在UI中以两个设备上相同的磅值正确定位。



例如:

  iPhone 5 iPhone 6 
| | | |
| | | |
| | | |
| [bttn] | | |
| ______ | | [bttn] |
| ________ |

如果您在UIImageView中显示照片,可以创建最大尺寸并让它要么缩小到iPhone 5(使用 UIViewContentModeScaleAspectFill ),要么保持原样(使用 UIViewContentModeCenter )。 / p>

最后,你真的不想管理每个设备的特定尺寸 - 如果你包括每个元素有2个高分辨率资产,这是一个很大的存储空间。为每个设备添加一个是不必要的,Apple从来没有打算这样做。


How to set corresponding MYimage.png for MyimageView in Xcode 6 with ios 8.x compatiblity.

MyimageView setImage:[UIImage imageNamed:@"MYimage.png"];

In Resources, I am having the following images with resolutions:

MYimage.png--320*480

MYimage@2x.png--640*960

MYimage-568h@2x.png--640*1136

MYimage-375h@2x.png--750*1334

MYimage-736h@3x.png--1242*2208

For iPhone 4s,it shows: MYimage@2x.png [Right]

For iPhone 5s,it shows: MYimage@2x.png [wrong]

For iPhone 6,it shows: MYimage@2x.png [wrong]

For iPhone 6+,it shows: MYimage@2x.png [wrong]

But after renaming the images as mentioned below:

MYimage.png--320*480

MYimage@2x.png--640*960

MYimage-568h@2x.png--640*1136

MYimage-375h@2x.png--750*1334

MYimage@3x.png--1242*2208

For iPhone 4s,it shows: MYimage@2x.png [Right]

For iPhone 5s,it shows: MYimage@2x.png [wrong]

For iPhone 6,it shows: MYimage@2x.png [wrong]

For iPhone 6+,it shows: MYimage@3x.png [Right]

So., What's the stated format to implement?

Note: Also googled following Links and so on..

解决方案

iOS only supports the size notations for launch images, for example this page describes the usage for 3.5", 4", and iPads in the format Default-568h@2x.png, etc.

What you're actually only able to support is @2x and @3x (see here) which explains why on each of the devices you're seeing it pick up the @2x and @3x pngs only.

Lastly, the MYimage@Xx.png--w*h isn't a valid size denotation either; those files won't be read by the system automatically when you reference an image named MYimage.png; at most you could do MYimage@2x.png and MYimage@3x.png.

Answering your question below:

iPhone 6 and iPhone 5 both render at the same pixel density. UI elements should be positioned correctly in the UI at the same point size on both devices.

For example:

iPhone 5       iPhone 6
|      |      |        |
|      |      |        |
|      |      |        |
|[bttn]|      |        |
|______|      | [bttn] |
              |________|

If you're displaying an photo in a UIImageView though, you can just create the largest size and let it either scale down to the iPhone 5 (using UIViewContentModeScaleAspectFill) or leave it as-is (using UIViewContentModeCenter).

In the end, you really don't want to have to manage specific dimensions for every single device out there - already if you're including 2 high-res assets for each element, that's a lot of storage space. Adding one for every device is unnecessary, and Apple never intended for that to be the case.

这篇关于iphone 6 vs iphone 5 image Naming Convention的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆