3

I'm trying to change the radius of MKCircle by moving an UISlider. The problem is that the radius property of MKCircle is readonly.

I tried in this way:

- (void)sliderValueChanged:(UISlider *)sender
{
    self.radiusLabel.text = [NSString stringWithFormat:@"%i mt", value];

    MKCircle * oldC = (MKCircle *)self.mapView.overlays[0];

    MKCircle * c = [MKCircle circleWithCenterCoordinate:self.lastLocation.coordinate radius:value];

    [self.mapView addOverlay:c];

    [self.mapView removeOverlay:oldC];
}

but the render is very slow and the circle is rendered tile-by-tile (like a pdf in quartz). Is there a better and faster way to change the radius ?

Thanks...

Fry
  • 6,235
  • 8
  • 54
  • 93

1 Answers1

0

You might be interested in the answer to this question: moving/updating MKOverlay on MKMapView

basically, instead of removing your old circle and adding a new one, you adjust the current one and tell the mapview to redraw that area.

Community
  • 1
  • 1
Craig
  • 8,093
  • 8
  • 42
  • 74