Skip to content

Commit

Permalink
o Added reloadTileSource: and reloadTileSourceAtIndex: (issue #35)
Browse files Browse the repository at this point in the history
  • Loading branch information
trasch committed Jul 6, 2012
1 parent 10bb254 commit cddb768
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
3 changes: 3 additions & 0 deletions MapView/Map/RMMapView.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,9 @@ typedef enum : NSUInteger {
- (void)setHidden:(BOOL)isHidden forTileSource:(id <RMTileSource>)tileSource;
- (void)setHidden:(BOOL)isHidden forTileSourceAtIndex:(NSUInteger)index;

- (void)reloadTileSource:(id <RMTileSource>)tileSource;
- (void)reloadTileSourceAtIndex:(NSUInteger)index;

#pragma mark - Cache

// Clear all images from the #tileSource's caching system.
Expand Down
25 changes: 25 additions & 0 deletions MapView/Map/RMMapView.m
Original file line number Diff line number Diff line change
Expand Up @@ -1532,6 +1532,31 @@ - (void)setHidden:(BOOL)isHidden forTileSourceAtIndex:(NSUInteger)index
((RMMapTiledLayerView *)[_tiledLayersSuperview.subviews objectAtIndex:index]).hidden = isHidden;
}

- (void)reloadTileSource:(id <RMTileSource>)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
Expand Down

0 comments on commit cddb768

Please sign in to comment.