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!
謝謝。
問題已解決 – TasZ