<分区>
<分区>
我有图片路径,我想在uiimageview中显示它,
/Users/WTS-New/Library/Developer/CoreSimulator/Devices/F43C26D2-DCFF-4764-AAF0-F6CC7BCDCF5D/data/Containers/Data/Application/8E49D340-7CAC-4031-85BF-9E5C26A1E37A/Documents/Small-mario.png
如何显示图片?
最佳答案
尝试使用下面的代码:
从图片名称获取图片路径:
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *imageFilePath;
NSError *err;
imageFilePath = [documentsDirectory stringByAppendingPathComponent:@"Small-mario.png"];
使用 imageWithContentsOfFile
方法设置图像:
YourImageView.image = [UIImage imageWithContentsOfFile: imageFilePath];
关于ios - 在 ios 中的 imageView 中显示来自路径的图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39248712/