So I can create annotations that I stick on the map, and I can create overlays, say either polygons or polylines, and have those drawn on the map with default renderers. Everything works as expected.
And I can even create an annotation view with a custom image that is drawn with an orientation. The problem is, I can't get a notification as the map is rotating, but only when it is done rotating, and I'd like to change my annotation view as the map is rotating (because my annotation involves orientation).
So I thought, hey, the polygons and lines get reoriented as the map is rotated, so I'll change my annotation to an overlay. The problem is, I can't get my custom renderer to draw anything.
To test, I created a subclass of MKPolylineRenderer
and overrode the draw method. And looking at a coordinate of the line:
self.polyline.points()[0]
It looks fine I guess, e.g.,
MKMapPoint(x: 263670550.06153709, y: 169200197.90301803)
But every time I try to convert that map point to a CGPoint, the y coordinate is always 0, and the x coordinate seems way too big:
let point = self.point(for: self.polyline.points()[0])
-> (52506.4039975107, 0.0)
If I call my superclass's draw method I can see my polyline, and the first point is definitely not at y=0, but I can't get anything in my overridden method to show up (again, seemingly because of registration issues, but not sure). I followed this advice:
Custom MKOverlayRenderer drawMapRect function not drawing polygons
Any ideas?