nvpolyline icon indicating copy to clipboard operation
nvpolyline copied to clipboard

Polyline View overlaps other Annotation Views

Open leviathan opened this issue 14 years ago • 0 comments

I've added several other annotation views to my map view.

All annotation views within the MKMapView annotations array are in somewhat random order. This may cause some annotation views to be overlapped by the polyline view.

Here's a solution. Would you be so kind and incorporate this in your example.

Add this to your view controller, which serves as your MKMapViewDelegate:

# pragma mark -
# pragma mark - MKMapViewDelegate

- (void)mapView:(MKMapView *)mapView didAddAnnotationViews:(NSArray *)views {
    for (int i=0; i<[views count]; i++) {
        MKAnnotationView *view = [views objectAtIndex:i];
        if ([view isKindOfClass:[NVPolylineAnnotationView class]]) {
            [[view superview] sendSubviewToBack:view];
        }
    }
}

leviathan avatar Jul 01 '10 14:07 leviathan