Hello. I got another question.
I need to draw half-circle on MKMapView knowing the center coordinates, start and end angles, and radius in nautical miles.
I have subclassed MKOverlayPathRenderer:
import UIKit
import MapKit
class IGAAcarsDrawArc: MKOverlayPathRenderer
{
let PI = 3.14159265
let radius : CGFloat = 10.0
var startAngle: CGFloat = 0
var endAngle: CGFloat = 3.14159
var latitude = 25.96728611
var longitude = -80.453019440000006
override func createPath()
{
let line = MKPolyline()
let arcWidth: CGFloat = 5
let path = UIBezierPath(arcCenter: CGPointMake(CGFloat(latitude), CGFloat(longitude)),
radius: self.radius,
startAngle: startAngle,
endAngle: endAngle,
clockwise: true)
path.lineWidth = arcWidth
path.stroke()
}
}
Now, it is not clear how do I use this to create MKPolyline and implement in mapView(mapView: MKMapView, rendererForOverlay overlay: MKOverlay). Does anyone know how to draw an arc in MKMapView?
Thanks a lot!