o Added methods to hide/show individual tilesource layers
Showing
3 changed files
with
44 additions
and
0 deletions
@@ -242,6 +242,9 @@ typedef enum { | @@ -242,6 +242,9 @@ typedef enum { | ||
242 | 242 | ||
243 | - (void)moveTileSourceAtIndex:(NSUInteger)fromIndex toIndex:(NSUInteger)toIndex; | 243 | - (void)moveTileSourceAtIndex:(NSUInteger)fromIndex toIndex:(NSUInteger)toIndex; |
244 | 244 | ||
245 | +- (void)setHidden:(BOOL)isHidden forTileSource:(id <RMTileSource>)tileSource; | ||
246 | +- (void)setHidden:(BOOL)isHidden forTileSourceAtIndex:(NSUInteger)index; | ||
247 | + | ||
245 | #pragma mark - Cache | 248 | #pragma mark - Cache |
246 | 249 | ||
247 | /// Clear all images from the #tileSource's caching system. | 250 | /// Clear all images from the #tileSource's caching system. |
@@ -1479,6 +1479,30 @@ | @@ -1479,6 +1479,30 @@ | ||
1479 | [self setCenterProjectedPoint:centerPoint animated:NO]; | 1479 | [self setCenterProjectedPoint:centerPoint animated:NO]; |
1480 | } | 1480 | } |
1481 | 1481 | ||
1482 | +- (void)setHidden:(BOOL)isHidden forTileSource:(id <RMTileSource>)tileSource | ||
1483 | +{ | ||
1484 | + NSArray *tileSources = [self tileSources]; | ||
1485 | + | ||
1486 | + for (NSUInteger i=0; i<[tileSources count]; ++i) | ||
1487 | + { | ||
1488 | + id <RMTileSource> currentTileSource = [tileSources objectAtIndex:i]; | ||
1489 | + | ||
1490 | + if (tileSource == currentTileSource) | ||
1491 | + { | ||
1492 | + [self setHidden:isHidden forTileSourceAtIndex:i]; | ||
1493 | + break; | ||
1494 | + } | ||
1495 | + } | ||
1496 | +} | ||
1497 | + | ||
1498 | +- (void)setHidden:(BOOL)isHidden forTileSourceAtIndex:(NSUInteger)index | ||
1499 | +{ | ||
1500 | + if (index >= [_tiledLayersSuperview.subviews count]) | ||
1501 | + return; | ||
1502 | + | ||
1503 | + ((RMMapTiledLayerView *)[_tiledLayersSuperview.subviews objectAtIndex:index]).hidden = isHidden; | ||
1504 | +} | ||
1505 | + | ||
1482 | #pragma mark - Properties | 1506 | #pragma mark - Properties |
1483 | 1507 | ||
1484 | - (UIView *)backgroundView | 1508 | - (UIView *)backgroundView |
@@ -9,6 +9,7 @@ | @@ -9,6 +9,7 @@ | ||
9 | #import "MainView.h" | 9 | #import "MainView.h" |
10 | 10 | ||
11 | #import "RMOpenStreetMapSource.h" | 11 | #import "RMOpenStreetMapSource.h" |
12 | +#import "RMOpenSeaMapLayer.h" | ||
12 | #import "RMMapView.h" | 13 | #import "RMMapView.h" |
13 | #import "RMMarker.h" | 14 | #import "RMMarker.h" |
14 | #import "RMCircle.h" | 15 | #import "RMCircle.h" |
@@ -111,6 +112,22 @@ | @@ -111,6 +112,22 @@ | ||
111 | 112 | ||
112 | [self updateInfo]; | 113 | [self updateInfo]; |
113 | [self performSelector:@selector(addMarkers) withObject:nil afterDelay:0.5]; | 114 | [self performSelector:@selector(addMarkers) withObject:nil afterDelay:0.5]; |
115 | + | ||
116 | +// double delayInSeconds = 5.0; | ||
117 | +// dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC); | ||
118 | +// dispatch_after(popTime, dispatch_get_main_queue(), ^(void){ | ||
119 | +// [mapView addTileSource:[[[RMOpenSeaMapLayer alloc] init] autorelease]]; | ||
120 | +// | ||
121 | +// dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC); | ||
122 | +// dispatch_after(popTime, dispatch_get_main_queue(), ^(void){ | ||
123 | +// [mapView setHidden:YES forTileSourceAtIndex:1]; | ||
124 | +// | ||
125 | +// dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC); | ||
126 | +// dispatch_after(popTime, dispatch_get_main_queue(), ^(void){ | ||
127 | +// [mapView setHidden:NO forTileSourceAtIndex:1]; | ||
128 | +// }); | ||
129 | +// }); | ||
130 | +// }); | ||
114 | } | 131 | } |
115 | 132 | ||
116 | - (void)didReceiveMemoryWarning | 133 | - (void)didReceiveMemoryWarning |
-
Please register or login to post a comment