iPhone 6+ simulator doesn't load @3x images from atlas

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-21 21:38:43

问题


What I've noticed when running project on iPhone 6+ simulator is that simulator don't pick up right images. Instead of @3x, @2x images are used.

I tried reseting simulators content and settings, clean project and delete derived data from organizer and same thing still happens.

When I look for the myatlas.atlasc folder inside the myapp.app (show package contents) at the path:

/Users/username/Library/Developer/Xcode/DerivedData/appname-appspecificgeneratedstring/Build/Products/Debug-iphonesimulator/appname.app

I can see myatlas.atlasc (note that this is not myatlas.atlas) and inside there are two files instead of three. There is atlas.1.png and atlas.1@2x.png.

I suppose that there should be three files, one for the 1@x images, one for the @2x images and another one for @3x images.

The content of the first image (atlas.1.png) are all @1x images and @3x images. And the content of the atlas.1@2x.png are @2x images.

Next thing I've tried is to use Texturepacker which properly generate atlas for us. The files generated are atlasfilename.1.png, atlasfilename.1@2x.png and atlasfilename.1@3x.png. Also there is a properly generated .plist file. I added atlasc folder to my project and checked "Create folder references" instead "Create groups". But still simulator picks @2x images.

Then I tried to make my own atlases named HD_atlas.atlas and XHD_atlas.atlas and based on screen scale factor choose right atlas. In that case the proper atlas is chosen but I got MissingResource.png on the screen. If I name @3x images like image.png instead of image@3x.png and put them in XHD_atlas.atlas folder, then @3x image is loaded, but it's 3 times bigger. For now, until this is fixed, I ended up using @2x assets instead of @3x, because everything still looks pretty decent, even if it's upscaled.

I suppose this shouldn't be like this, and if anybody know how to make Spritekit to generate properly atlases or have some workaround in order to use @3x assets please feel free to post a suggestion.

来源:https://stackoverflow.com/questions/29241752/iphone-6-simulator-doesnt-load-3x-images-from-atlas

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