我想从位于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 的打印说明:
/Users/Admin/Library/Application Support/iPhone Simulator/5.0/Applications/6842528E-9629-4DE7-96C1-A46AEB8A8EE0/Library/Thapa
它应该是:
getImagePath 的打印说明:
/Users/Admin/Library/Application Support/iPhone Simulator/5.0/Applications/6842528E-9629-4DE7-96C1-A46AEB8A8EE0/Library/Thapa/images47.png
如何实现这一点不知道,我尝试的是上面的。
提前致谢