开发者

Custom overlay on Google Map?

a general question, is it possible to have a custom overlay (or more than one overlays) above the Google Map using iPhone Map Kit开发者_运维知识库? Thanks for any comments.


If you’re interested in rendering images or image tile overlays rather than vector shapes, subclassing MKOverlayView and defining [-canDrawMapRect:zoomScale] and [drawMapRect:zoomScale:inContext:] can do it for you.

I’ve got an example that uses [-canDrawMapRect:zoomScale] to check the local cache and asynchronously handle tile loads (if a tile isn't cached), and then [drawMapRect:zoomScale:inContext:] to handle rendering the resulting UIImage into the CoreGraphics context.

http://github.com/mtigas/iOS-MapLayerDemo


when you mean a drawing of Shapes like Polygon an Polyline and things like that you can use MKOverlay (realy good since iOS 4). there are two steps needed: - use "addOverlay" to add one (or more) Overlay(s) 2 use (MKOverlayView *)mapView:(MKMapView *)mapView viewForOverlay:(id )overlay to make clear wich way the Overlay is presented.


I've had good luck adding multiple layers of image overlays using MKOverlay. Our current app features 13 large image overlays, and performance is still good.

For some good sample code, check out Apple's TileMap sample from WWDC 2010.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜