开发者

MKMapView: Bring some annotation views above others?

开发者 https://www.devze.com 2023-01-02 14:00 出处:网络
I have an MKAnnotationView subclass called ImageAnnotationView.It basically displays an image on the map.I want the regular MKAnnotationView views (the default pins) to appear above the ImageAnnotatio

I have an MKAnnotationView subclass called ImageAnnotationView. It basically displays an image on the map. I want the regular MKAnnotationView views (the default pins) to appear above the ImageAnnotationView views.

This is what I've tried so far but it doesn't seem to work:

- (void)mapView:(MKMapView *)imapView didAddAnnotationViews:(NSArray *)views {
    for (MKAnnotationView *annView in views) {
        if ( [annView isKindOfClass:[ImageAnnotationView class]]开发者_运维知识库 ) {
            [imapView sendSubviewToBack:annView];
        }
    }
}

Am I doing this in the wrong place? Are the MKAnnotationViews all direct subviews of MKMapView or is there some hidden hierarchy?

Any ideas or help are welcome.


it should work, im doing same just in MKAnnotationView subclass [[self superview] sendSubviewToBack:self];

0

精彩评论

暂无评论...
验证码 换一张
取 消