#import "UIImageView+Qiniu.h" #import @implementation UIImageView (Qiniu) - (void)qiniu_setImageWithURL:(NSURL *)url { NSURLComponents *components = [[NSURLComponents alloc] initWithURL:url resolvingAgainstBaseURL:NO]; CGFloat scale = [[UIScreen mainScreen] scale]; CGSize size = self.frame.size; NSString *query = [NSString stringWithFormat:@"imageView2/2/w/%1.0f/h/%1.0f/format/JPG", size.width * scale, size.height * scale]; [components setQuery:query]; NSLog(@"Loading image: %@", [components URL]); [self setImageWithURL:[components URL]]; } @end