Retina images (@2x~ipad) not loaded if iPad image doesn't exist (~ipad)

余生长醉 提交于 2019-12-23 01:40:08

问题


I have something strange in my app.

If in the ressources I have 2 files named : myFile~ipad.png and myFile@2x~ipad.png the retina image is loaded on iPad retina as it should be. But If i have two files named myFile.png and myFile@2x~ipad.png, the retina images is never loaded and myFiles.png is used for all devices.

Is this normal ? The problem is that I want to use the image myFile.png for iPhone, iPhone retina and iPad and the image myFile@2x~ipad.png for iPad retina so I can't put the extension ~ipad beyond myFile.png.


回答1:


Use symlink. I just google it, and didn't say it couldn't be done, but most of it points to symlink in an SD card.




回答2:


You can have the same image "myFile.png" with different name as myFile~ipad.png so that you can have same result for iPhone, iPhone retina and iPad. And "myFile@2x~ipad.png" image for ipad retina display.

hope this will help.




回答3:


We tried using symlinks, but it turns out that in the built app, the symlinks actually turned into copies of the images they linked to. Xcode resolves symlinks by copying the source file. So you can use symlinks for convenience, but not to save storage space in the built app.



来源:https://stackoverflow.com/questions/9923559/retina-images-2xipad-not-loaded-if-ipad-image-doesnt-exist-ipad

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!