【发布时间】:2014-01-11 10:11:59
【问题描述】:
我正在从我存储在我的文档目录中的 kml 文件中绘制地图叠加层。我一次查看大约 30 到 40 个 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;
}
}
任何帮助将不胜感激!
谢谢。
【问题讨论】:
-
已解决 boundingMapRect 问题
标签: ios iphone objective-c kml