0

我在视图中的每个按钮单击时都使用 SDWebImageDownloader 类加载图像。

__block UIActivityIndicatorView *activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
activityIndicator.center = mainImage.center;
activityIndicator.hidesWhenStopped = YES;

[activityIndicator startAnimating];
[imgView setImageWithURL:url   placeholderImage:[UIImage imageNamed:@"placeholderLarge.png"] options:0 andResize:CGSizeMake(mainImage1.frame.size.width,imgview.frame.size.height) withContentMode:UIViewContentModeScaleAspectFit];
[imgView addSubview:activityIndicator];

我没有找到删除活动指示器的位置

4

1 回答 1

1

您可以使用以下块..它更有效,对我有用...

[imgView setImageWithURL:url placeholderImage:[UIImage imageNamed:@"Default.png"] success:^(UIImage *image, BOOL cached){
        [activityIndicator stopAnimating];
    } failure:^(NSError *error){  
     //do any additional tasks if its failure
        }];
于 2013-03-01T07:45:39.777 回答