在mapkit上画一个圆 [英] Drawing a circle on mapkit

查看:47
本文介绍了在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:

  1. 使用circleWithCenterCoordinate:radius:方法创建MKCircle对象并将其添加到您的mapView中(使用addOverlay:方法)
  2. 在mapView委托实现mapView:viewForOverlay:方法中,在那里创建并设置MKCircleView实例并返回它
  1. Create MKCircle object using circleWithCenterCoordinate:radius: method and add it to your mapView (using addOverlay: method)
  2. In mapView delegate implement mapView:viewForOverlay: method, create and setup MKCircleView 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆