Authored by Justin R. Miller

added marker image cache clear method

... ... @@ -82,7 +82,7 @@ typedef enum {
* @return An initialized RMMarker layer. */
- (id)initWithMapBoxMarkerImage:(NSString *)symbolName;
/** Initializes and returns a newly allocated marker object using a medium-sized pin image, a given symbol name, e.g., `bus`, and a given color.
/** Initializes and returns a newly allocated marker object using a medium-sized pin image, a given symbol name, e.g., `bus`, and a given color.
* @param symbolName A symbol name from the [Maki](http://mapbox.com/maki/) icon set.
* @param color A color for the marker.
* @return An initialized RMMarker layer. */
... ... @@ -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;
... ...