我在document文件夹中有一张图片。我想在表视图中显示它。我试过了,但我不知道我的代码是什么
NSString *imagelist = some image name.png;
//-----------
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *yourFilePath = [documentsDirectory stringByAppendingPathComponent:imagelist];
UIImageView *img=[[UIImageView alloc] initWithFrame:CGRectMake(5,5,50,40)];
// img.image=[UIImage imageWithData:imagedata];
[cell.contentView addSubview:img];
NSURL *pptURL = [NSURL fileURLWithPath:yourFilePath];
NSURLRequest *request = [NSURLRequest requestWithURL:pptURL];
[img loadRequest:request];
[cell.contentView addSubview:img];提前感谢
发布于 2011-07-14 15:41:29
你看过苹果的开发者文档了吗?这里有一个XML编程指南,其中包含示例代码以及您需要了解的所有内容。
http://developer.apple.com/library/mac/ipad/#documentation/Cocoa/Conceptual/XMLParsing/XMLParsing.html%23//apple_ref/doc/uid/10000186-SW1
https://stackoverflow.com/questions/6689634
复制相似问题