简体   繁体   English

Mapkit画一个圆

[英]Mapkit drawing a circle

I would like to do the following using the MapKit in iOS. 我想在iOS中使用MapKit执行以下操作。

I want to place a position on a map and draw a circle around it where the diameter of the circle represents a range. 我想在地图上放置一个位置,并在其周围绘制一个圆圈,圆圈的直径代表一个范围。 This circle should have a solid color with an alpha of 25%. 该圆圈应具有25%的纯色。 Much like the circle you get around your own position using google maps when the position is not accurate enough. 就像圆圈一样,当位置不够准确时,您会使用Google地图绕过自己的位置。 Deciding how large the circle should be could either be using an extra view or using pinching. 可以使用额外的视图或使用捏合来确定圆的大小。

How can I do this? 我怎样才能做到这一点?

For the drawing part, couldn't you just draw a square then round it's corners? 对于绘图部分,您能否仅绘制一个正方形然后将其圆角化?

#import <Quartz/QuartzCore.h>

-(void)viewDidLoad{
    mapRect.cornerRadius = mapRect.frame.size.height/2;//Corner radius = height/2
}

Something like that should get you half way there. 那样的事情应该会让您半途而废。 I don't know how you're doing the collision detection though. 我不知道您如何进行碰撞检测。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM