我在视图中按下每个按钮时使用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];
我无法删除activityIndicator
的位置答案 0 :(得分: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
}];