在mapkit上画一个圆 [英] Drawing a circle on mapkit
本文介绍了在mapkit上画一个圆的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我必须在地图上画一个圆,它必须以一个点为中心约1.8英里.我该怎么做?
I got to draw a circle on my map, it has to be about 1,8 miles centered on a point.. How can I do it?
推荐答案
基本上,您需要执行2个步骤:
Basically you need to do 2 steps:
- 使用
circleWithCenterCoordinate:radius:
方法创建MKCircle对象并将其添加到您的mapView中(使用addOverlay:
方法) - 在mapView委托实现
mapView:viewForOverlay:
方法中,在那里创建并设置MKCircleView
实例并返回它
- Create MKCircle object using
circleWithCenterCoordinate:radius:
method and add it to your mapView (usingaddOverlay:
method) - In mapView delegate implement
mapView:viewForOverlay:
method, create and setupMKCircleView
instance there and return it
如果您有不同的叠加层类型,则可能需要在委托方法中执行一些类型检查,以创建适合每种叠加层类型的叠加层视图.
If you have different overlay types you may need to perform some type-checks in delegate method to create overlay views appropriate for each type of overlay.
这篇关于在mapkit上画一个圆的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文