properly set layer scale for MapBox markers
Showing
1 changed file
with
3 additions
and
3 deletions
@@ -139,17 +139,17 @@ | @@ -139,17 +139,17 @@ | ||
139 | (symbolName ? [@"-" stringByAppendingString:symbolName] : @""), | 139 | (symbolName ? [@"-" stringByAppendingString:symbolName] : @""), |
140 | (colorHex ? [@"+" stringByAppendingString:[colorHex stringByReplacingOccurrencesOfString:@"#" withString:@""]] : @""), | 140 | (colorHex ? [@"+" stringByAppendingString:[colorHex stringByReplacingOccurrencesOfString:@"#" withString:@""]] : @""), |
141 | (useRetina ? @"@2x" : @"")]]; | 141 | (useRetina ? @"@2x" : @"")]]; |
142 | - | 142 | + |
143 | UIImage *image; | 143 | UIImage *image; |
144 | 144 | ||
145 | NSString *cachePath = [NSString stringWithFormat:@"%@/%@", kCachesPath, [imageURL lastPathComponent]]; | 145 | NSString *cachePath = [NSString stringWithFormat:@"%@/%@", kCachesPath, [imageURL lastPathComponent]]; |
146 | 146 | ||
147 | - if ((image = [UIImage imageWithContentsOfFile:cachePath]) && image) | 147 | + if ((image = [UIImage imageWithData:[NSData dataWithContentsOfFile:cachePath] scale:(useRetina ? 2.0 : 1.0)]) && image) |
148 | return [self initWithUIImage:image]; | 148 | return [self initWithUIImage:image]; |
149 | 149 | ||
150 | [[NSFileManager defaultManager] createFileAtPath:cachePath contents:[NSData dataWithContentsOfURL:imageURL] attributes:nil]; | 150 | [[NSFileManager defaultManager] createFileAtPath:cachePath contents:[NSData dataWithContentsOfURL:imageURL] attributes:nil]; |
151 | 151 | ||
152 | - return [self initWithUIImage:[UIImage imageWithContentsOfFile:cachePath]]; | 152 | + return [self initWithUIImage:[UIImage imageWithData:[NSData dataWithContentsOfFile:cachePath] scale:(useRetina ? 2.0 : 1.0)]]; |
153 | } | 153 | } |
154 | 154 | ||
155 | - (void)dealloc | 155 | - (void)dealloc |
-
Please register or login to post a comment