简体   繁体   English

适用于通用应用程序的不同大小的iPhone和iPad的图像处理

[英]Image handling for different sizes of iPhone and iPad for universal app

I am new in iOS 我是iOS新手

my question is we can take different sizes of images for app icon that support iPhone and iPad pick that images default as per screen resolutions. 我的问题是,对于支持iPhone和iPad的应用程序图标,我们可以采用不同大小的图像,请根据屏幕分辨率选择默认图像。

same thing how to apply for other images in app. 同样的事情如何在应用程序中申请其他图像。 also is it necessary take every image with different sizes or resolutions? 是否有必要拍摄具有不同尺寸或分辨率的每张图像?

if it is necessary then what is the best way for that? 如果有必要,那么最好的方法是什么?

appreciate for help. 感谢您的帮助。

  • For Other Images: 对于其他图像:

Let's assume our image is supposed to be called “name”. 假设我们的图像被称为“名称”。 We need to supply four image resources. 我们需要提供四个图像资源。 The iPhone resources are supposed to have the ~iphone suffix and accordingly the iPad resources need the ~ipad suffix and the @2x for the retina display is in between the name and the suffix. iPhone资源应该具有〜iphone后缀,因此iPad资源需要〜ipad后缀,并且@ 2x用于视网膜显示在名称和后缀之间。 So this is what we get: 这就是我们得到的:

•   name~iphone.png
•   name@2x~iphone.png
•   name~ipad.png
•   name@2x~ipad.png
•   name-568h@2x~iphone.png (iPhone 5)

It is important that the suffix is all lowercase. 后缀必须全部小写,这一点很重要。 With this naming convention there is no need to do that any more because 有了这个命名约定,就不再需要这样做了,因为

[UIImage imageNamed:@"name.png"];

handles the loading of all different image sizes. 处理所有不同图像尺寸的加载。

For more info see this & this . 有关更多信息,请参见thisthis

  • For App Icon: 对于应用程序图标:

You should use Asset Catalog. 您应该使用资产目录。

For more info see Link1 , Link2 & Link3 有关更多信息,请参见Link1Link2Link3。

  • For Lunch Images: 午餐图片:

see this . 看到这个

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

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