2014-01-11 36 views
1

我在我的文档目录中存储的kml文件的地图上绘制覆盖图。我一次查看大约30到40 kml的文件,线条颜色存储在kml中。问题是其中一些不显示。不显示所有覆盖,从kml文件生成

- (MKOverlayView *)mapView:(MKMapView *)mapView viewForOverlay:(id <MKOverlay>)overlay 
{ 
    return [kmlParser viewForOverlay:overlay]; 
} 

上面的代码是从基准KMLViewer可以从here

当我写下面的代码它工作完全正常下载但所有生成的KML文件绘制与黑色

- (MKOverlayView *)mapView:(MKMapView *)mapView viewForOverlay:(id <MKOverlay>)overlay 
{ 
     MKOverlayPathView *overlayPathView; 

     if ([overlay isKindOfClass:[MKPolygon class]]) 
     { 
      overlayPathView = [[MKPolygonView alloc] initWithPolygon:(MKPolygon*)overlay]; 

      overlayPathView.fillColor = [[UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1.0] colorWithAlphaComponent:0.2]; 
      overlayPathView.strokeColor = [[UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1.0] colorWithAlphaComponent:0.7]; 
      overlayPathView.lineWidth = 3; 

      return overlayPathView; 
     } 
} 

任何帮助将大大appreciable!

谢谢。

+0

问题已解决 – TasZ

回答

1

boundingMapRect可能是罪魁祸首请检查地图的缩放水平以及其boundingmaprect财产具有boundingMapRect问题

相关问题