iPhone:MKAnnotation 显示弹出窗口?

发布于 2024-08-31 20:23:04 字数 112 浏览 2 评论 0 原文

我有一个 MKMapView,它有一个引脚,按下时会显示注释的标题和副标题。

代码中是否有一种方法可以自动显示此文本,以便用户无需单击它?

如果我有很多图钉,它们也能全部显示吗?

I have a MKMapView that has a pin than when pressed shows the annotation's title and subtitle.

Is there a way in code to have this text shown automatically so the user does not need to click it?

If I have many pins, can they all appear as well?

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

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

发布评论

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

评论(3

没企图 2024-09-07 20:23:04

您需要使用 selectAnnotation 消息:

- (void)selectAnnotation:(id <MKAnnotation>)annotation animated:(BOOL)animated

选择指定的注释并
显示它的标注视图。

You need to use the selectAnnotation message on MKMapView:

- (void)selectAnnotation:(id <MKAnnotation>)annotation animated:(BOOL)animated

Selects the specified annotation and
displays a callout view for it.

缱绻入梦 2024-09-07 20:23:04

这可能有帮助:

- (void)setSelected:(BOOL)selected animated:(BOOL)animated

This might help:

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
一枫情书 2024-09-07 20:23:04

如果您的 MKMapView 称为 mapView 并且您的 MKAnnotation 称为 myAnnotation 那么这将起作用:

[mapView selectAnnotation:myAnnotation animated:YES];

If your MKMapView is called mapView and your MKAnnotation is called myAnnotation then this will work:

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