From cddb768bcc4c4c390f86b2e21bc1e58339a786fa Mon Sep 17 00:00:00 2001 From: Thomas Rasch Date: Fri, 6 Jul 2012 10:28:29 +0200 Subject: [PATCH] o Added reloadTileSource: and reloadTileSourceAtIndex: (issue #35) --- MapView/Map/RMMapView.h | 3 +++ MapView/Map/RMMapView.m | 25 +++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/MapView/Map/RMMapView.h b/MapView/Map/RMMapView.h index 886123cc3..6ea451410 100644 --- a/MapView/Map/RMMapView.h +++ b/MapView/Map/RMMapView.h @@ -204,6 +204,9 @@ typedef enum : NSUInteger { - (void)setHidden:(BOOL)isHidden forTileSource:(id )tileSource; - (void)setHidden:(BOOL)isHidden forTileSourceAtIndex:(NSUInteger)index; +- (void)reloadTileSource:(id )tileSource; +- (void)reloadTileSourceAtIndex:(NSUInteger)index; + #pragma mark - Cache // Clear all images from the #tileSource's caching system. diff --git a/MapView/Map/RMMapView.m b/MapView/Map/RMMapView.m index 0b688dbf3..c3090c27d 100644 --- a/MapView/Map/RMMapView.m +++ b/MapView/Map/RMMapView.m @@ -1532,6 +1532,31 @@ - (void)setHidden:(BOOL)isHidden forTileSourceAtIndex:(NSUInteger)index ((RMMapTiledLayerView *)[_tiledLayersSuperview.subviews objectAtIndex:index]).hidden = isHidden; } +- (void)reloadTileSource:(id )tileSource +{ + // Reload the map layer + for (RMMapTiledLayerView *tiledLayerView in _tiledLayersSuperview.subviews) + { + if (tiledLayerView.tileSource == tileSource) + { +// tiledLayerView.layer.contents = nil; + [tiledLayerView setNeedsDisplay]; + break; + } + } +} + +- (void)reloadTileSourceAtIndex:(NSUInteger)index +{ + if (index >= [_tiledLayersSuperview.subviews count]) + return; + + // Reload the map layer + RMMapTiledLayerView *tiledLayerView = [_tiledLayersSuperview.subviews objectAtIndex:index]; +// tiledLayerView.layer.contents = nil; + [tiledLayerView setNeedsDisplay]; +} + #pragma mark - Properties - (UIView *)backgroundView