-3

我有一个图片链接,现在我想在我的应用程序中加载这张图片并使用类别

[test setImageWithURL:[NSURL URLWithString:@"close"]];

链接图片是:

close

我看到链接图像很好,但是 imageview 无法加载图像。请告诉我为什么,谢谢!

4

2 回答 2

1

好的试试这个

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;
                     }
                 });
             }
        });
于 2013-07-29T10:05:20.927 回答
1

testUIImageView 对象吗?它需要。

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"]];
于 2013-07-29T15:25:58.913 回答