我正在使用Core user.i保存的CoreData中的Image的路径在属性userImage(NSString)中。路径保存成功。现在我需要通过检索保存的路径在UIImageView中显示图像。但是我得到空的ImageView我正在做这件事。如何做。
UIImage *img = [_usersDataArray valueForKey:@"userimage"];
_userImage = [[UIImage alloc] initWithContentsOfFile:img];
答案 0 :(得分:0)
使用+ (UIImage *)imageWithContentsOfFile:(NSString *)path
UIImage *image = [UIImage imageWithContentsOfFile:imagePath];
答案 1 :(得分:0)
由于您要保存图像路径,因此可以通过以下方式获取图像:
NSString imagePath = imagePathFromMO;// image path from the managed object
UIImage *img = [UIImage imageWithContentsOfFile:imagePath ];