Is it possible to add an overlay image on top of a map added in my app? I am using MapKit to show the map of an area. I would like to add an overlay image on top of the map before the pins show up
i.e. the stack should be map->image overlay->pins
Is it possible without going into the hierarchy of views – get all subviews of the view and then add an image just on top of the map?
Thanks.
I know that you need a solution for a static map , but here’s one for a “draggable” one , which should also solve your problem.
You should subclass
MKOverlayView, and override its (empty by default):- (void)drawMapRect:(MKMapRect)mapRect zoomScale:(MKZoomScale)zoomScale inContext:(CGContextRef)context.The method should actually do what
drawRectdoes in views.You should also implement another “should” method , that should return TRUE if the overlay should be visible on screen (in your case.. always ?).
In the overriden method , you should draw your image on top of the map (according to the mapRect and zoomScale of course) , and viola!
Some more reference :
http://developer.apple.com/library/ios/#documentation/UserExperience/Conceptual/LocationAwarenessPG/AnnotatingMaps/AnnotatingMaps.html#//apple_ref/doc/uid/TP40009497-CH6-SW15