下面的代码没有显示从网上下载并写入我的应用程序文档目录的图像。我检查了iphone的模拟器文件目录里面,下载的文件是存在的。但图像不显示。
尝试使用 添加资源图像UIImage *imgBack = [UIImage imageNamed:@"btn-back.png"];
时,uiimageview 显示 image.bu 从在线下载并存储在应用程序目录中的图像不显示图像。
请告诉我,谢谢
NSString *workSpacePath=[[self applicationDocumentsDirectory] stringByAppendingPathComponent:theFileName];
NSLog(@"%@ workSpacePath ",workSpacePath);
if ( workSpacePath ){
//--------------
UIImage *imgBack = [UIImage imageNamed:@"btn-back.png"];
imageView1 = [[[UIImageView alloc] initWithFrame:CGRectMake(0,0,20,20)] autorelease];
[imageView1 setBackgroundColor:[UIColor grayColor]];
imageView1.image = [UIImage imageWithData:[NSData dataWithContentsOfFile:workSpacePath]];
[cell addSubview:imageView1];
}