There are actually two ways to implement the real "Hide Google Tiles" method (the johndope solution only overlays it but does not prevent the tiles from loading).
Beware that the option described below may reject your application, and option 2 will not, but a little more complicated.
General Part: Retrieving an MKMapTileView
Inside each MKMapView lies an undocumented class like: MKMapTileView . An extraction is not a cause of failure. In this code, the MKMapView instance will be called mapView
UIView* scrollview = [[[[mapView subviews] objectAtIndex:0] subviews] objectAtIndex:0]; UIView* mkTiles = [[scrollview subviews] objectAtIndex:0];
Option 1: Undocumented method (may be a reason for rejection!)
if ( [mkTiles respondsToSelector:@selector(setDrawingEnabled:)]) [mkTiles performSelector:@selector(setDrawingEnabled:) withObject:(id)NO];
This will prevent calling the undocumented setDrawingEnabled method on the setDrawingEnabled instance.
Option 2: Swizzling Method
Outside of your controller implementation, you will write the following:
// Import runtime.h to unleash the power of objective C
And somewhere in your code (as soon as your map view is loaded!):
Hope this helps anyone, this code was originally described in this post.
source share