Iphone:如何在图像视图中显示文档目录图像? [英] Iphone : How to Display Document Directory images in Image View?
本文介绍了Iphone:如何在图像视图中显示文档目录图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在存储在文档目录文件夹中的应用程序图像中,
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 Directory ?
推荐答案
示例代码:
- (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
这篇关于Iphone:如何在图像视图中显示文档目录图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文