开发者

Putting an image into an MKOverlayView in the MapKit in Xcode

I want to make a mapkit overlay with a png, but i have no code for it and I cant find any tutorials on it. I am a novice coder, so lots of help would be greatly appreciated!

Tha开发者_如何转开发nks


There are a few things you need to do to get this going:

  1. Create a custom MKOverlayView subclass that actually draws your image.
  2. Add an overlay (an object that implements the MKOverlay protocol) to your MKMapView. Apple provides a number of overlay classes—MKCircle, MKPolygon, etc.—one is likely to be suitable.
  3. Implement the mapView:viewForOverlay: method in your MKMapView's delegate to return an instance of your custom overlay view.

The section Displaying Overlays on a Map in Apple's Location Awareness Programming Guide should help clarify all of these steps. As for drawing the image, have a look at CGContextDrawImage().

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜