I want to refresh my MKOverlay with a new fillColor (hotSpot[@"intensity"]). Is there a way to force call the rendererForOverlay method? It only gets called once when the map is loaded.
-(MKOverlayRenderer*)mapView:(MKMapView*)mapView rendererForOverlay:(id<MKOverlay>) overlay{
MKPolygonRenderer *square;
for(NSDictionary *hotSpot in hotSpots) {
if([overlay.title containsString:hotSpot[@"id"]]) {
square = [[MKPolygonRenderer alloc] initWithOverlay:overlay];
square.fillColor = [[UIColor redColor] colorWithAlphaComponent:[hotSpot[@"intensity"] floatValue]];
}
}
return square;
}
I've tried but was not successful with:
[map setNeedsDisplay];
[map setNeedsDisplayInRect:CGRectMake(0,0,map.layer.frame.size.width,map.layer.frame.size.height)];
MKCoordinateRegion region = map.region;
region.span.longitudeDelta /= 1.01;
region.span.latitudeDelta /= 1.01;
[map setRegion:region animated:TRUE];
You could add & remove the same MKOverlay object. That forces a call to rendererForOverlay, even when you have the same overlay.