Naming Images on iOS platforms

本文介绍了iOS应用中图像资源的命名规范,包括不同设备及分辨率下图片文件的命名方式,以便于开发过程中根据不同设备自动加载合适的图像资源。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Naming Images

Nothing earth shattering here, but it’s not clearly spelled out in the documentation…at least not in an easy to find manner. If you have an image, let’s say background.png, you should create three separate images.

  • background~iphone.png – Used on non retina-display iPhones
  • background@2x.png – Used on retina display iPhones
  • background~ipad.png – Used on iPad devices

Note that those are tilde characters, not dashes. When you want to grab that image, you simply pass the name “background” to UIImage’s imagedNamed: method and it will grab the proper one for you. Keeps you from having to create special naming conventions that you put in your code as Apple has already done it for you. This will likely change when the new iPad comes out if the rumors of retina display there are true, but for now, those are your names.

 

From: http://gargoylesoft.com/blog/2011/03/naming-images/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值