除了@2x,UIImage 还支持哪些标签? [英] Apart from @2x, what other tags are supported by UIImage?
问题描述
我知道我可以使用 @2x
标签为 Retina 屏幕自动加载图像.还支持哪些其他标签?
I know I can use the @2x
tag to automatically load images for Retina screens. What other tags are supported?
推荐答案
目前支持三种标签:
@2x
适用于 Retina 屏幕.~iPad
for iPad,必须是扩展前的最后一个标签.~iPhone
适用于 iPhone 和 iPod Touch,同样必须是最后一个.
@2x
for Retina screens.~iPad
for iPad, has to be the last tag before the extension.~iPhone
for iPhone and iPod Touch, again, has to be the last.
对于初始屏幕,还有适用于 iPhone 5 的 Default-568h@2x
版本.这表明您可以使用 -568h
自动加载 iPhone 5 的图像,但不幸的是,情况并非如此(rdar://12516489).您可以修补 UIImage
类以自己添加支持.
For the splash screen there’s also the Default-568h@2x
version for iPhone 5. This suggests that you can use -568h
to automatically load images for iPhone 5, but that’s unfortunately not the case (rdar://12516489). You can patch the UIImage
class to add the support yourself.
最后有五种可能的图像变体:
In the end there are five possible image variants:
Image.png
对于旧设备,480✕320Image@2x.png
适用于 Retina,960✕640Image-568h@2x.png
for Retina, 1136✕640,仅在修补UIImage
Image~iPad.png
适用于较旧的 iPad,1024✕768Image@2x~iPad.png
适用于 Retina iPad,2048✕1536
Image.png
for older devices, 480✕320Image@2x.png
for Retina, 960✕640Image-568h@2x.png
for Retina, 1136✕640, only after patchingUIImage
Image~iPad.png
for older iPads, 1024✕768Image@2x~iPad.png
for Retina iPad, 2048✕1536
所有这些都在 GitHub 上的 iOS Image Loader 示例项目中进行了展示.
All this is showcased in iOS Image Loader sample project on GitHub.
这篇关于除了@2x,UIImage 还支持哪些标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!