4

I'm using MKCircle for displaying the user location on MKMapView. This is done by a few lines of code:

MKCircle creation:

self.mapCircle = MKCircle(center: pinLocation, radius: 50)
self.mapView.add(self.mapCircle!)

Rendering, using MKMapViewDelegate:

func mapView(_ mapView: MKMapView, rendererFor overlay: MKOverlay) -> MKOverlayRenderer {
        guard let circle = overlay as? MKCircle else { return MKOverlayRenderer(overlay: overlay) }

        let renderer = MKCircleRenderer(circle: circle)

        renderer.strokeColor = .red
        renderer.lineWidth = 1

        return renderer
}

It is behaving pretty well untill I zoom out and zoom in back. Then i get the vertical line artefact, which is appearing at the same place all time. It doesn't depend on the stroke width.

my annoying stroke artefact

Does anyone know any solution to avoid appearing that artefact?

  • Did you figure this out in the end? There's a few questions around MKMapView overlays with artefacts but none seem to have an answer. – Kane Cheshire Aug 14 '17 at 19:57
  • Hi @KaneCheshire. I changed the design, so I didn't need to deal with this bug anymore. I would appreciate if you inform me once you find a solution. – Dmitriy Kirakosyan Aug 15 '17 at 08:50
  • I haven't yet, but I'm playing around with overriding drawMapRect to make sure it only draws into the map which intersects with the circle. Seems promising. – Kane Cheshire Aug 15 '17 at 09:00
  • @DmitriyKirakosyan did you manage to solve anything related to this? I'm struggling to find any kind of useful solution (in my case just polylines in general) – Programmer Jul 16 '23 at 17:50
  • 1
    @Programmer, I didn't unfortunately and I'm not on this project anymore. TBH I'm surprised this bug still exists... – Dmitriy Kirakosyan Jul 18 '23 at 13:56

0 Answers0