我有一个捆绑包,其中我放了一些图片。
内容如下:
MyBundle.bundle/images/picture1.png
MyBundle.bundle/images/picture2.png
我将MyBundle.bundle
拖入了我的项目中。
现在我可以在Interface Builder中看到这些图像,甚至可以使用它们。但是,当我运行应用程序时,我看不到这些图像。
有什么问题吗?
谢谢!
我有一个捆绑包,其中我放了一些图片。
内容如下:
MyBundle.bundle/images/picture1.png
MyBundle.bundle/images/picture2.png
我将MyBundle.bundle
拖入了我的项目中。
现在我可以在Interface Builder中看到这些图像,甚至可以使用它们。但是,当我运行应用程序时,我看不到这些图像。
有什么问题吗?
谢谢!
请确保在目标项目的"Build Phases"设置中将bundle文件复制过去。
另外,尝试编程设置它们,看看是否显示:
myImageView.image = [UIImage imageNamed:@"MyBundle.bundle/images/picture1.png"];
我刚在我的项目中尝试了一下,发现你需要做的是在图片名称前面加上bundle名称,像这样:MyBundle.bundle/images/picture1.png
。2011-10-12 08:22:16.360 UTDebug[721:11c03] Could not load the "map.png" image referenced from a nib in the bundle with identifier "com.companyname.myproject"
你也需要将XIB文件放入bundle中。这样做的话,界面资源将相对于bundle路径,所以无论是在IB中还是在应用程序中加载接口时都会正常工作。
FrameworkName.bundle/imageName.png
,它对我也没有用。我还尝试使用标识符(com.name等),但那也不起作用... - jowie