简体   繁体   English

什么可能导致图像栏iOS中的图像看起来很难看?

[英]What can possible cause image look ugly in tab bar iOS?

I have 2 images. 我有2张图片。

The first one (@2x: 50x50, 72 pixels/ inches) is like this: 第一个(@ 2x:50x50,72像素/英寸)是这样的:

在此输入图像描述

It look so ugly in Tab Bar: Tab Bar看起来很难看:

在此输入图像描述

The second one (@2x: 48x42, 72 pixels/inches) is like this: 第二个(@ 2x:48x42,72像素/英寸)是这样的:

在此输入图像描述

Even it is smaller, it look good in Tab Bar: 即使它更小,它在Tab Bar看起来也不错:

在此输入图像描述

I cannot see the different between the 2 images. 我无法看到2张图片之间的差异。 Can you see and tell me why? 你能看到并告诉我为什么吗? I'm new in designing images for iphone. 我是为iPhone设计图像的新手。 How can I design good image for tab bar? 如何为标签栏设计好图像? Here you can download the images. 在这里,您可以下载图像。

Now you can set that image size according to the devices you are using 现在,您可以根据所使用的设备设置图像大小

Tab bar icon (optional) iPhone 6 Plus (@3x) 标签栏图标(可选)iPhone 6 Plus(@ 3x)

About 75 x 75 (maximum: 144 x 96) 约75 x 75(最大值:144 x 96)

iPhone 6 and iPhone 5 (@2x) About 50 x 50 (maximum: 96 x 64) iPhone 6和iPhone 5(@ 2x)约50 x 50(最大值:96 x 64)

iPhone 4s (@2x) About 50 x 50 (maximum: 96 x 64) iPhone 4s(@ 2x)约50 x 50(最大:96 x 64)

iPad and iPad mini (@2x) About 50 x 50 (maximum: 96 x 64) iPad和iPad mini(@ 2x)约50 x 50(最大值:96 x 64)

iPad 2 and iPad mini (@1x) About 25 x 25 (maximum: 48 x 32) iPad 2和iPad mini(@ 1x)约25 x 25(最大值:48 x 32)

According to the screenshot, I am suspecting image size. 根据截图,我怀疑图像大小。

I can't tell the exact reason why because never seen document regarding that found yet. 我无法确切地说明原因,因为从未见过关于那个的文件。

But in the practical experience those somewhat "distort" border problem happens when the image size and the control size are different even it has 1 pixel differences. 但是在实际经验中,当图像尺寸和控制尺寸不同时,即使它具有1个像素差异,也会发生这种“扭曲”边界问题。

For example, My UIImageView size is 32x 50, and my @2x image file for that imageView is 64 x 101. This can be cases because when we slice down, original image can have this pixel differences and we keep it for aspect ratio. 例如,我UIImageView大小为32×50,我为@ 2倍的图像文件imageView是64×101这可能是案件,因为当我们切下来,原始图像可以有这样的像素差异和我们保持宽高比。

In this case, the size can be said 32 x 50.5 which is actually a bit difference and then, the image is showing "distort" or "blur" at it's border 在这种情况下,大小可以说是32 x 50.5,这实际上是有点差异然后,图像在它的边界显示“扭曲”或“模糊”

Solution is just change it's image size as required. 解决方案只是根据需要更改图像大小。

After hours of researching finally I found out the reason. 经过几个小时的研究终于找到了原因。 It's so silly of myself but I have to post this with hope that it will save time for other iOS developers who also want to design their own app: 这对我自己来说太愚蠢但是我必须发布这个帖子,希望它能为其他想要设计自己的应用程序的iOS开发人员节省时间:

Basically when exporting images to be used inside your app, your need to export with with PNG-24 type. 基本上在导出要在应用程序内使用的图像时,需要使用PNG-24类型导出。 That's all. 就这样。 (See image below as an example). (见下图作为例子)。

在此输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM