gpt4 book ai didi

iOS mapkit - 如何在图钉悬停时显示文本

转载 作者:行者123 更新时间:2023-11-29 01:26:36 25 4
gpt4 key购买 nike

我使用的是 iOS 9 和 Swift 2。

我一直无法找到使用 mapkit 在 map 上存在的图钉悬停时显示文本的方法。

我想在没有标注的情况下执行此操作,这会强制用户点击图钉。

有什么想法吗?

最佳答案

并没有像网络应用那样真正的“悬停”。有点击(选中)或没有点击(未选中),但抛开术语不谈,您会想要使用 MKAnnotationView。具体来说,我将使用此方法将其替换为 UILabel:

func viewForAnnotation(_ annotation: MKAnnotation) -> MKAnnotationView?

这将使您可以将 View 设置为任何您想要的,因此创建 UILabel View ,然后将其设置为您的注释 View

关于iOS mapkit - 如何在图钉悬停时显示文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33930128/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com