0
__block UIActivityIndicatorView *activityIndicator;
__weak UIImageView *weakImageView = self.headpic;
[self.headpic setImageWithURL:imageUrl placeholderImage:nil options:SDWebImageProgressiveDownload progress:^(NSInteger receivedSize, NSInteger expectedSize){
if (!activityIndicator) {
[weakImageView addSubview:activityIndicator = [UIActivityIndicatorView.alloc initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge]];
activityIndicator.center = weakImageView.center;
[activityIndicator startAnimating];
}
}
completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType){
[activityIndicator removeFromSuperview];
activityIndicator = nil;
}];
headpic의 이미지를 설정할 수 있습니다,이 코드를 사용하여 NSHomeDirectory로 이미지를 다운로드, 그리고 동시에 NSHomeDirectory
에 (이미지 URL에서) 서버 이미지를 다운로드하려면, 어떻게 할까?SDWebImage
그래서 당신은'UIImage'이 파일에 저장하는 방법을 요구하고있다 :
사용법은 매우 간단합니다? – trojanfoe
@trojanfoe 답장을 보내 주셔서 감사합니다. – yegomo