2

我将图像保存在文件夹“pic”中(图像完整路径的示例:)/Users/apple/Library/Application Support/iPhone Simulator/5.1/Applications/2526EA68-229D-40BC-BB57-56E46EB55691/Documents/pic/1.jpg


“文档”路径是通过调用获得的:

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0]; 

所以路径肯定是正确的。但是当我这样做时:

 [tempImage setImage:[UIImage imageNamed:fullImagePath]]

似乎找不到图像,因为没有显示图像。我想知道这个问题的原因以及如何解决它?

4

1 回答 1

6

imageNamed仅适用于主包中的图像,不适用于子目录。

采用

[UIImage imageWithContentsOfFile:filePath]

反而。

于 2012-05-10T14:50:39.757 回答