如何将图像从iphone中的主项目传递到库项目

时间:2012-06-22 06:38:18

标签: iphone

我有一个图书馆项目和一个主要项目,我想将图像从主项目传递到我的图书馆项目,所以我可以做到这一点。

1 个答案:

答案 0 :(得分:0)

将图像添加到库项目中。

在代码中使用图像时,而不是使用

UIImage *image = [UIImage imageNamed:@"img.png"];

使用如下:

NSBundle *bundle = nil;

bundle = [NSBundle bundleWithIdentifier:@"com.test.libary"]; //library project's identifier

UIImage *image = [UIImage imageWithContentsOfFile: [bundle pathForResource:@"img" ofType:@"png"]];
相关问题