(Using iOS 5 and Xcode 4.2)
I have an MKMapView and want to draw a circle of 1000m radius around the user location.
On the surface it would seem tha
Swift 3/ Xcode 8 here:
func addRadiusCircle(location: CLLocation){
if let poll = self.selectedPoll {
self.mapView.delegate = self
let circle = MKCircle(center: location.coordinate, radius: 10)
self.mapView.add(circle)
}
}
func mapView(_ mapView: MKMapView, rendererFor overlay: MKOverlay) -> MKOverlayRenderer {
if overlay is MKCircle {
let circle = MKCircleRenderer(overlay: overlay)
circle.strokeColor = UIColor.red
circle.fillColor = UIColor(red: 255, green: 0, blue: 0, alpha: 0.1)
circle.lineWidth = 1
return circle
} else {
return MKPolylineRenderer()
}
}
Then call like so:
self.addRadiusCircle(location: CLLocation(latitude: YOUR_LAT_HERE, longitude: YOUR_LNG_HERE))