Advertisement
Guest User

MKMapView: how to disable base canvas visibility

a guest
Nov 10th, 2013
745
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. - (UIView*) viewToDeactivateInView:(UIView*)view {
  2.     UIView *viewFound = nil;
  3.     if( view && view.subviews && [view.subviews count] > 0 ) {
  4.         for( UIView *currentView in view.subviews ) {
  5.             NSString *className = NSStringFromClass( [currentView class] );
  6.             if( [className isEqualToString:@"VKMapCanvas"] ) {
  7.                 viewFound = currentView;
  8.                 break;
  9.             }
  10.             else {
  11.                 viewFound = [self viewToDeactivateInView:currentView];
  12.                 if( viewFound ) {
  13.                     break;
  14.                 }
  15.             }
  16.         }
  17.     }
  18.     return viewFound;
  19. }
  20.  
  21. - (void) baseMapEnableVisibility:(BOOL)isVisible {
  22.     UIView *targetView = [self viewToDeactivateInView:localMapView];
  23.     if( targetView ) {
  24.         NSLog( @"MAP CANVAS: %@", NSStringFromClass([targetView class]) );
  25.         [targetView.layer setOpacity:(isVisible ? 1.0 : 0.0)];
  26.     }
  27.     else {
  28.         NSLog( @"MAP CANVAS NOT FOUND." );
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement