【发布时间】:2012-10-31 12:33:41
【问题描述】:
我想从位于NSLibraryDirectory 的文件夹中获取图像。
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory,NSUserDomainMask, YES);
NSString *documentsDirectory = [[paths objectAtIndex:0] stringByAppendingPathComponent:[NSString stringWithFormat:str]];
NSString *getImagePath = [documentsDirectory stringByAppendingPathComponent: [@"images" stringByAppendingFormat:@"%d",[[NSUserDefaults standardUserDefaults] integerForKey:@"HighScore"]] stringByAppendingFormat:@".png"];
img = [UIImage imageWithContentsOfFile:getImagePath];
NSLog(@"img:%@", img);
这是我使用的代码
getImagePath 的打印说明:
/用户/管理员/库/应用程序支持/iPhone 模拟器/5.0/Applications/6842528E-9629-4DE7-96C1-A46AEB8A8EE0/Library/Thapa
应该是:
getImagePath 的打印说明:
/用户/管理员/库/应用程序支持/iPhone 模拟器/5.0/Applications/6842528E-9629-4DE7-96C1-A46AEB8A8EE0/Library/Thapa/images47.png
这个不知道怎么实现的,我试过的都在上面。
提前致谢
【问题讨论】: