0

Hello i am working on map related app in which i have to draw multiple polygon on mk mapview. it's load fine at first time . enter image description here

As you can see in image.but if i change the zoom level all the colours are changed in mapview as shown in picture below. enter image description here

-(MKOverlayRenderer *)mapView:(MKMapView *)mapView rendererForOverlay:(id<MKOverlay>)overlay
{
 if([overlay isKindOfClass:[MKPolygon class]]){
MKPolygonRenderer *renderer = [[MKPolygonRenderer alloc] initWithPolygon:overlay];
            renderer.fillColor=noflyzonecolor;
            renderer.strokeColor=noflyzonestrokecolor;
            renderer.lineWidth=strokeWidth;
  return renderer;
}
}
Alvin Nguyen
  • 250
  • 4
  • 10
vipal
  • 1
  • 1
  • Are `noflyzonecolor` and `noflyzonestrokecolor` constants or variables? Log what colors they are or add a “watch” on them and I’ll wager they’re getting changed somewhere. – Rob Feb 26 '19 at 17:51
  • they are not constant they are variables its depending on API response . As i said its load fine at first time. – vipal Feb 27 '19 at 04:23
  • Well, the problem would appear to rest in how you parsed the API response and updated these variables and then initiated the adding of the overlays. And, btw, if the color is an attribute of the overlay, you should create an overlay subclass with that property. But we’re just guessing until you show how the parsing and adding of overlays works. – Rob Feb 27 '19 at 05:00

0 Answers0