简体   繁体   English

使细节按钮在 iOS MapView 中始终可见

[英]Making detail button always visible in iOS MapView

I have a map view on my iOS app and i want to make detail button that when user press the pin icon visible without interaction.我在我的 iOS 应用程序上有一个地图视图,我想让详细信息按钮在用户按下图钉图标时可见而无需交互。 It should be visible when user open the map.当用户打开地图时它应该是可见的。 Is it possible to make it?有可能做到吗? I use the code for showing annotation, I need it for button.我使用代码来显示注释,我需要它作为按钮。

标注图片

self.mapView.showAnnotations([destinationAnnotation], animated: true )

Yes it is possible to show annotation once you load map.是的,加载地图后可以显示注释。 You can simply make annotation is "selected".您可以简单地使注释被“选中”。 While this is generally achieved by a user tapping on the annotation view (ie the pin), you can also programmatically "select" the annotation:虽然这通常是通过用户点击注释视图(即大头针)来实现的,但您也可以以编程方式“选择”注释:

mapView.selectAnnotation(annotation, animated: true)

When you add pin.添加引脚时。

您可以尝试以编程方式选择 mapView annoattion:

mapView.selectAnnotation(annotation, animated:false)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM