From 9620fffa64381fd8b2f76ffdb09a314a75aec2cb Mon Sep 17 00:00:00 2001 From: Bogdan Poplauschi Date: Thu, 19 Mar 2015 23:44:25 +0200 Subject: [PATCH] @3x support - replaced #1005 --- SDWebImage/SDWebImageCompat.m | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/SDWebImage/SDWebImageCompat.m b/SDWebImage/SDWebImageCompat.m index 562bacd27..8a53754c8 100644 --- a/SDWebImage/SDWebImageCompat.m +++ b/SDWebImage/SDWebImageCompat.m @@ -30,11 +30,16 @@ if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)]) { CGFloat scale = 1.0; if (key.length >= 8) { - // Search @2x. at the end of the string, before a 3 to 4 extension length (only if key len is 8 or more @2x. + 4 len ext) + // Search @2x. or @3x. at the end of the string, before a 3 to 4 extension length (only if key len is 8 or more @2x./@3x. + 4 len ext) NSRange range = [key rangeOfString:@"@2x." options:0 range:NSMakeRange(key.length - 8, 5)]; if (range.location != NSNotFound) { scale = 2.0; } + + range = [key rangeOfString:@"@3x." options:0 range:NSMakeRange(key.length - 8, 5)]; + if (range.location != NSNotFound) { + scale = 3.0; + } } UIImage *scaledImage = [[UIImage alloc] initWithCGImage:image.CGImage scale:scale orientation:image.imageOrientation];