-3
我非常沮丧地从NSDocumentDirectory访问多个图像。看看我在这个过程中所做的步骤以及我想从你那里得到的东西。从NSDocumentDirectory保存和访问图像的iOS图像
我的应用程序可以用下面的代码下载图片:
// get the image from the url
UIImage *image = [[UIImage alloc] initWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:urlString]]];
// Save the image file into document folder
NSString *dir = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)objectAtIndex:0];
// Saving JPG File
**NSString *jpefilepath = [dir stringByAppendingPathComponent:[NSString stringWithFormat:@"%dwallpaper.jpg",arc4random()]];**
NSData *data1 = [NSData dataWithData:UIImageJPEGRepresentation(image, 1.0f)];
[data1 writeToFile:jpefilepath atomically:YES];
有了这个代码我下载各种影像以独特的名称。我用jpefilepath直接存储在mysql数据库中。
现在我有问题如何从示例代码直接访问本地路径的图像。
[?你尝试过什么(HTTP:// whathaveyoutried。 COM /) – rckoenes 2013-03-07 13:42:37