I have a case where I need to import an overlay map in top of MkMapView. The overlay totally covers the google tiles below so there is no need loading, plus it adds overhead to the app.
Is there a way to tell mkMapView to stop loading tiles?
I have a case where I need to import an overlay map in top of MkMapView. The overlay totally covers the google tiles below so there is no need loading, plus it adds overhead to the app.
Is there a way to tell mkMapView to stop loading tiles?
I encountered a related problem but in my case my overlay didn't cover all the google tiles. If anyone has this problem, and is trying to stop loading the google tiles, I managed to superimpose one gray tile(256x256) overlay over the google map tiles. To do this, the top level tile must be /FakeTiles/1/1/0.png and add this directory to resources to project. (N.B. don't drag this into project > Add files > Folders > Create folder references for any folders)
then add your custom tile overlay.
Then you need this code to scale the grey tile Calculating tiles to display in a MapRect when "over-zoomed" beyond the overlay tile set
As far as I know you can't prevent
MKMapView
from loading Google Maps tiles, and there's a chance your app will be rejected if it covers up the Google logo while displaying anMKMapView
– you may want to consider writing a customUIScrollView
to display your map instead.Actually there are 2 ways to implement the real "Hide Google tiles" method (johndope solution only puts an overlay on top of it but doesn't prevent the tiles from loading).
Beware that option one described below might get your application rejected while option 2 will not but is a bit more complex.
Common Part: Retrieve the
MKMapTileView
objectInside each
MKMapView
lies an undocumented class of type:MKMapTileView
. Retrieving it is NOT a reason for rejection. In this code theMKMapView
instance will be calledmapView
Option 1: Undocumented Method (!! can be a reason for rejection !! )
This will prevent the undocumented method
setDrawingEnabled
to be called on theMKMapTileView
instance.Option 2: Method Swizzling
Outside of your controller implementation you will write someting like:
And somewhere in your code (once your map view is loaded!) :
Hope this helps anyone, this code was originally described in this blog post.