NSString *imgvalue=[[NSString alloc]initWithString:item.imgItem];
printf("\n img1 value is %s",[imgvalue UTF8String]);
cell.imageView.image=[UIImage imageNamed:@"unknown.jpg"];
if (imgvalue !=nil)
{
NSData *imageData;
@try
{
printf("\n image value in image data is %s",[imgvalue UTF8String]);
imageData = [[NSData alloc]initWithContentsOfURL:[NSURL URLWithString:imgvalue]];
printf("\n imageData Length is %d",[imageData length]);
}
@catch (NSException * e)
{
//printf("Exception message is %s",[e);
}
@finally
{
UIImage * imageFromImageData = [[UIImage alloc] initWithData:imageData];
//[image setImage:imageFromImageData];
cell.imageView.image=imageFromImageData;
[imageData release];
[imageFromImageData release];
}
}
获得 imgValue 后,我复制了该 url,当我在浏览器中签入时,它向我显示了图像,但它没有存储到 NSData。请帮助我