我想用新的 fillColor (hotSpot[@"intensity"]) 刷新我的 MKOverlay。有没有办法强制调用 rendererForOverlay 方法?它只在地图加载时被调用一次。
-(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;
}
我试过但没有成功:
[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];