Authored by Justin R. Miller

added marker image cache clear method

... ... @@ -106,7 +106,10 @@ typedef enum {
* @param colorHex A color for the marker specified as an HTML hex code.
* @param sizeString A size such as `small`, `medium`, or `large`.
* @return An initialized RMMarker layer. */
- (id)initWithMapBoxMarkerImage:(NSString *)symbolName tintColorHex:(NSString *)colorHex sizeString:(NSString *)sizeString;
- (id)initWithMapBoxMarkerImage:(NSString *)symbolName tintColorHex:(NSString *)colorHex sizeString:(NSString *)sizeString;
/** Clears the local cache of Mapbox Marker images. Images are cached locally upon first use so that if the application goes offline, markers can still be used. */
+ (void)clearCachedMapBoxMarkers;
/** @name Altering Labels */
... ...
... ... @@ -152,6 +152,13 @@
return [self initWithUIImage:[UIImage imageWithData:[NSData dataWithContentsOfFile:cachePath] scale:(useRetina ? 2.0 : 1.0)]];
}
+ (void)clearCachedMapBoxMarkers
{
for (NSString *filePath in [[NSFileManager defaultManager] contentsOfDirectoryAtPath:kCachesPath error:nil])
if ([[filePath lastPathComponent] hasPrefix:@"pin-"] && [[filePath lastPathComponent] hasSuffix:@".png"])
[[NSFileManager defaultManager] removeItemAtPath:[NSString stringWithFormat:@"%@/%@", kCachesPath, filePath] error:nil];
}
- (void)dealloc
{
self.label = nil;
... ...