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

后端 未结 7 2340
星月不相逢
星月不相逢 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:33

    You can achieve it, By knowing the names of your images, so while you are storing your image you need to store some information of these images in database,(or some where you can use it), then fetch name of image from data source, and work as follows:

    NSString *str = [NSString stringWithFormat:@"%@.jpg",[myGlobleArrayOfImageNames objectAtIndex:imageCounter]];
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsDirectory = [paths objectAtIndex:0];
    NSString *fullImgNm=[documentsDirectory stringByAppendingPathComponent:[NSString stringWithString:str]];
    [mainSlideShowImageView setImage:[UIImage imageWithContentsOfFile:fullImgNm]];
    

提交回复
热议问题