Fixed an issue that causes URLs with trailing parameters to be assigned an incorrect image scale value

This commit is contained in:
Andrey Marinov 2015-05-25 19:48:23 +03:00
parent 91b4251115
commit 8f309e194e
1 changed files with 2 additions and 3 deletions

View File

@ -30,13 +30,12 @@ inline UIImage *SDScaledImageForKey(NSString *key, UIImage *image) {
if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)]) {
CGFloat scale = 1.0;
if (key.length >= 8) {
// 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)];
NSRange range = [key rangeOfString:@"@2x."];
if (range.location != NSNotFound) {
scale = 2.0;
}
range = [key rangeOfString:@"@3x." options:0 range:NSMakeRange(key.length - 8, 5)];
range = [key rangeOfString:@"@3x."];
if (range.location != NSNotFound) {
scale = 3.0;
}