viewForOverlay method not being called while parsing KML

297 Views Asked by At

I'm using KML to show some overlays in map view. After parsing KML file I added overlay to my map view, but the map view delegate method viewForOverlay is not being called even if I set delegate property to map view.

What are the possible reasons for this problem?

NSURL *url = [NSURL fileURLWithPath:filePath];
kmlParser = [[KMLParser alloc] initWithURL:url];

[kmlParser parseKML];

// Add all of the MKOverlay objects parsed from the KML file to the map.
NSArray *overlays = [kmlParser overlays];
[self.mapView addOverlays:overlays];

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

I have done it using KMLViewer example.

0

There are 0 best solutions below