简体   繁体   中英

Mapkit drawing a circle

I would like to do the following using the MapKit in iOS.

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%. Much like the circle you get around your own position using google maps when the position is not accurate enough. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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