Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Polyline View overlaps other Annotation Views #2

@leviathan

Description

@leviathan

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];
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions