Iphone UIImage+;AFX27;行不通
我有一个图像链接,现在我想在我的应用程序中加载此图像,并使用分类Iphone UIImage+;AFX27;行不通,iphone,ios,afnetworking,Iphone,Ios,Afnetworking,我有一个图像链接,现在我想在我的应用程序中加载此图像,并使用分类 [test setImageWithURL:[NSURL URLWithString:@"close"]]; 链接图像为: close 我看到链接图像很好,但imageview无法加载图像。请告诉我为什么,谢谢 好的,试试这个 dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0ul); dispat
[test setImageWithURL:[NSURL URLWithString:@"close"]];
链接图像为:
close
我看到链接图像很好,但imageview无法加载图像。请告诉我为什么,谢谢 好的,试试这个
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0ul);
dispatch_async(queue, ^(void) {
NSData *imageData = [NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://216.57.222.146:8080/Stafflink_Web/images/assets/5108029/5108029_0_resized.jpg"];
UIImage* image = [[UIImage alloc] initWithData:imageData];
if (image) {
dispatch_async(dispatch_get_main_queue(), ^{
if (cell.tag == indexPath.row) {
test.image = image;
}
});
}
});
test
是UIImageView对象吗?这是必须的
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 100.0f, 100.0f)];
[imageView setImageWithURL:[NSURL URLWithString:@"http://i.imgur.com/r4uwx.jpg"] placeholderImage:[UIImage imageNamed:@"placeholder-avatar"]];
测试是否为有效的imageview?插座连接?@NitinGohel:可以使用此扩展名,意思是你说什么不明白,先生..我测试其他链接图像很正常,但此链接不正常,设置时图像可能有问题,请将同一图像上载到其他路径并尝试设置谢谢,但这不是我想要的方法,您知道afnetworking或SDwebimage为我们提供了缓存映像,并为tableview单元提供了良好的负载