gpt4 book ai didi

iphone - 使用 SDWebImageDownloader 显示和隐藏 ActivityIndi​​cator

转载 作者:行者123 更新时间:2023-11-29 04:06:15 25 4
gpt4 key购买 nike

我在 View 中单击的每个按钮上都使用 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];

我不知道在哪里删除 ActivityIndi​​cator

最佳答案

您可以使用以下 block ..它更有效并且对我有用...

[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
}];

关于iphone - 使用 SDWebImageDownloader 显示和隐藏 ActivityIndi​​cator,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15152824/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com