How to draw a circle on mapView

I am developing an application in which I have to show mapView. What I definitely want to do is when the user presses the radius button, this radius should be surrounded with the center point as the current location. Please tell me how I can draw a filled circle on my map that indicates the radius from the current location.

Any help would be much appreciated Thanks in advance!

+4
source share
2 answers

Create a new instance of MKCircle with the appropriate center and radius, and then add it to the map display overlays. MKCircle is a subclass of MKOverlay, so you can handle it just like any other waybill. Example:

MKCircle *myCircle = [MKCircle circleWithCenterCoordinate:myCenterPoint radius:myRadius]; [myMapView addOverlay:myCircle]; 

I will leave this to you to replace the "current location" and the user-selected radius for myCenterPoint and myRadius in the above code.

+10
source

If you want to draw something on a map, your best friend is MKOverlay .. Search Google for MKOverlay training courses.

MKCircle is the class you want to know about. Just read the docs to find out some idea.

Just select circleWithCenterCoordinate: radius

+3
source

All Articles