Why does resource bundle copy .png as .tiff images?

纵饮孤独 提交于 2019-12-31 09:29:08

问题


I've created a static library and a resource bundle for reusing code and assets across several projects.

Within the static library, I have a manager class whose sole purpose is to create other UIViewControllers, whose views are created from .xib files (using the common initWithNibName:bundle: method).

When I create the view in Interface Builder, the images show correctly. However, when I run the app on the simulator, I get this error:

    Could not load the "<image_name.png>" image referenced from a nib in the 
    bundle with identifier "com.<my_company>.<app_identifer>"

After hours of grinding, I finally inspected the resources bundle, and I found that the .png files weren't in it! Instead, .tiff files of the same name (excluding @2x versions) were there instead.

All of the images are included within the bundle's build phase under copy bundle resources , and I've used the images on other iOS projects (so they're not corrupted).

Has anyone else experienced this? Is it safe to assume that the images will always be added to the bundle as .tiff? (And if so, is it safe to just change the image name in interface builder to .tiff?) Or am I doing something incorrect here?

Thanks for your help in advance.


回答1:


For the issue of resource bundles , refer to this link as it has a couple of similar faced queries.

Conversion Resource bundle

Tell me which answer really helped you solve this issue. Thanks.




回答2:


This Solved my problem

In your bundle target Go to,

Build Settings > COMBINE_HIDPI_IMAGES and set to NO



来源:https://stackoverflow.com/questions/12560799/why-does-resource-bundle-copy-png-as-tiff-images

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