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

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

    sample code:

    - (NSString *)applicationDocumentsDirectory {
        return [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
    }
    
    -(void)loadimage{
        NSString *workSpacePath=[[self applicationDocumentsDirectory] stringByAppendingPathComponent:@"your image-name"];
        UIImageView *myimage=[UIImageView alloc] initWithFrame:CGRectMake(0,0,20,20)];
        myimage.image=[UIImage imageWithData:[NSData dataWithContentsOfFile:workSpacePath]];    
        [self.view addSubView:myimage];
        [myimage release];
    }
    

    TNQ

提交回复
热议问题