为什么资源包将 .png 复制为 .tiff 图像?

Why does resource bundle copy .png as .tiff images?(为什么资源包将 .png 复制为 .tiff 图像?)

本文介绍了为什么资源包将 .png 复制为 .tiff 图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个静态库和一个资源包,用于跨多个项目重用代码和资产.

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

在静态库中,我有一个管理器类,其唯一目的是创建其他 UIViewControllers,其视图是从 .xib 文件创建的(使用常见的 initWithNibName:bundle: 方法).

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).

当我在 Interface Builder 中创建视图时,图像会正确显示.但是,当我在模拟器上运行应用程序时,我收到此错误:

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>"

经过几个小时的打磨,我终于检查了资源包,发现 .png 文件不在其中!取而代之的是 .tiff 同名文件(不包括 @2x 版本).

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.

所有图片都包含在 复制捆绑资源 下的捆绑包构建阶段,并且我已在其他 iOS 项目中使用过这些图片(因此它们不会损坏).

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).

有其他人经历过吗?假设图像将始终作为 .tiff 添加到捆绑包中是否安全?(如果是这样,将界面生成器中的图像名称更改为 .tiff 是否安全?)还是我在这里做错了什么?

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?

提前感谢您的帮助.

推荐答案

关于资源包的问题,​​请参考这个链接,因为它有几个类似的问题.

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

转换资源包

告诉我哪个答案真正帮助您解决了这个问题.谢谢.

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

这篇关于为什么资源包将 .png 复制为 .tiff 图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:为什么资源包将 .png 复制为 .tiff 图像?

基础教程推荐