Iphone : How to Display Document Directory images in Image View?

后端 未结 7 2311
星月不相逢
星月不相逢 2020-12-01 17:07

In a App images stored in Document Directory Folder,

I wanted Particular image display in Image view,

How that image Display in Image View from the Document

相关标签:
7条回答
  • 2020-12-01 17:44

    Simple Use This Code

    NSFileManager *filemgr =[NSFileManager defaultManager];
    NSArray *dirPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask, YES);
    NSString *docsDir = [dirPaths objectAtIndex:0];
    NSString *dataPath = [docsDir stringByAppendingPathComponent:@"/yourdirectory/image.jpg"];
    NSData *imgData = [[NSData alloc] initWithContentsOfURL:[NSURL fileURLWithPath:dataPath]];
    self.imageview.image = [[UIImage alloc] initWithData:imgData];
    
    0 讨论(0)
提交回复
热议问题