【发布时间】:2017-01-07 17:09:57
【问题描述】:
我想在ios中从本地加载图片,
我在我的文件中添加了这段代码,
NSString *path = [NSString stringWithFormat:@"%@/Documents/Small-mario.png", NSHomeDirectory()];
NSLog(@"path %@", path);
displayImg.image = [UIImage imageNamed:path];
iget 的路径是,
/Users/WTS-New/Library/Developer/CoreSimulator/Devices/F43C26D2-DCFF-4764-AAF0-F6CC7BCDCF5D/data/Containers/Data/Application/06FE9A96-7705-4FB7-B291-4716CC6679C3/Documents/Small- mario.png
但是图像没有显示在图像视图中。
【问题讨论】:
-
imageNamed 不起作用,使用
NSData dataWithContentsOfFile:path然后UIImage imageWithData: -
图片“Small-mario.png”在您的应用程序包中吗?
-
他的图片“Small-mario.png”在我的画廊中。 @ddb
-
画廊是什么意思?
-
我的 iphone 画廊。 @KetanParmar
标签: ios objective-c xcode uiimageview