我在 Download
文件夹中有一个 compass.jpg
文件。然后我将此图像拖到我的 Images.xcassets
中。我通过右键单击图像条目和 view folder
确保图像确实在文件夹中。
然后,在 Storyboard中,我将我的 Logo ImageView 设置为此图像,并使用名称 compass
。这一切都在 Storyboard 中显示得很好。
但是,然后,我在我的 iPhone 和模拟器中启动了我的应用程序。它给了我以下错误:
Could not load the "compass" image referenced from a nib in the
bundle with identifier "com.x.Point"
我不知道如何解决这个问题。图像的文件夹确实在 Images.xcassets
文件夹中。
我该如何解决这个问题?
更新
我最终不得不做出妥协,将图像添加到项目本身而不是其 .imageassets
文件夹中。
我实际上创建了一个新项目并将我的所有源代码复制并粘贴到那里,然后 .imageasset
文件夹再次工作!我想这不是我项目设置的问题。它一定与 XCode 有关,我仍然不确定。
最佳答案
您需要将图像拖到 Image.xcassets 文件夹之外并拖到您的项目中。 xcassets 文件仅用于初始图像和图标。
关于ios - 图像 Assets : Could not load the image referenced from a nib in the bundle with identifier,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28044272/