Obj-C MkMapView多边形叠加颜色很奇怪,模糊了mapView / glitching

时间:2017-10-05 07:00:42

标签: ios mapkit mkmapview polygon mkmapviewdelegate

当我点击注释图标时,我得到这个粉红色区域和多边形,?放大和缩小时不会显示。我在模拟器和设备上都遇到了这个问题。

enter image description here

- (MKOverlayRenderer *)mapView:(MKMapView *)mapView rendererForOverlay:(id <MKOverlay>)overlay{
MKPolygonRenderer *rendr = [[MKPolygonRenderer alloc]initWithOverlay:overlay];
rendr.lineWidth = 5.0;

rendr.strokeColor = polygonColor;

rendr.fillColor=[UIColor clearColor];

if(polygonColor.CGColor == [UIColor greenColor].CGColor || polygonColor.CGColor == [UIColor blueColor].CGColor){

}

else if([[rendr polygon] pointCount] == 3 )
    rendr.strokeColor = [UIColor redColor];
else if([[rendr polygon] pointCount] == 4)
    rendr.strokeColor = [UIColor purpleColor];
else if([[rendr polygon] pointCount] == 5)
    rendr.strokeColor = [UIColor orangeColor];
else
    rendr.strokeColor = [UIColor magentaColor];

return rendr;

}

0 个答案:

没有答案