0

So I got an MKCirlce (MKOverlay), and I've added it like this:

self.current_location_overlay = MKCircle(center: self.current_location!, radius: 200)
self.mk_map_view.add(self.current_location_overlay!)

I've set the map delegate and added this MKMapViewDelegate method:

func mapView(_ mapView: MKMapView, rendererFor overlay: MKOverlay) -> MKOverlayRenderer {
    if let overlay = overlay as? MKCircle {
        let circle_renderer = MKCircleRenderer(circle: overlay)
        circle_renderer.fillColor = UIColor.red.withAlphaComponent(0.2)
        circle_renderer.setNeedsDisplay()
        return circle_renderer
    } else {
        return MKOverlayRenderer(overlay: overlay)
    }
}

Tho the overlay is not appearing at start, only after panning or zooming the map it appears.

Seems like others have had this problem, tho no solution on this post seems to help.

Dose anyone know how to solve this?

Heestand XYZ
  • 1,993
  • 3
  • 19
  • 40
  • Do you have this problem on iOS 10 or 11? I have the same problem but only on iOS 11 beta 4. Works fine on iOS 10. I'll run more tests and file a radar with Apple if it appears to be a problem with MapKit. The code in the post you linked is old – MKOverlayView is deprecated since iOS 7. – Andrew Jul 30 '17 at 23:27
  • I am indeed running iOS 11 beta 4, I'll try the beta 5! – Heestand XYZ Aug 10 '17 at 13:07
  • Where did you add your first two lines? – Reinier Melian Aug 29 '17 at 12:03
  • @ReinierMelian After I got the current location, in a custom method. – Heestand XYZ Aug 30 '17 at 14:18

0 Answers0