MKMapView:将一些注释视图置于其他视图之上?

发布于 2024-09-04 17:14:36 字数 543 浏览 1 评论 0原文

我有一个名为 ImageAnnotationView 的 MKAnnotationView 子类。它基本上在地图上显示图像。我希望常规 MKAnnotationView 视图(默认引脚)出现在 ImageAnnotationView 视图上方。

这是我到目前为止所尝试过的,但似乎不起作用:

- (void)mapView:(MKMapView *)imapView didAddAnnotationViews:(NSArray *)views {
    for (MKAnnotationView *annView in views) {
        if ( [annView isKindOfClass:[ImageAnnotationView class]] ) {
            [imapView sendSubviewToBack:annView];
        }
    }
}

我是否在错误的地方做这件事? MKAnnotationViews 是 MKMapView 的所有直接子视图还是有一些隐藏的层次结构?

欢迎任何想法或帮助。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

子栖 2024-09-11 17:14:36

它应该可以工作,我在 MKAnnotationView 子类中做同样的事情 [[self superview] sendSubviewToBack:self];

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文