如何显示所有标注标注Swift

How to show all annotations call out Swift

我有一个有很多注释的应用程序,我希望在开始时打开他们的标注(如果可能的话永远不会消失)。 从现在开始,我完成的是始终只出现一个,当我点击地图时,它会随着这条线消失:

 mapView.selectAnnotation(mapView.annotations[1], animated: true)

提前致谢。

我刚刚做了一些研究,我发现 不可能 来自 public API 和 MKMapView机制。

下面的代码只是 select 一个注解,同时 deselect 前一个注解。

for annotation in mapView.annotations {
     mapView.selectAnnotation(annotation, animated: true)
}

因此,要提供您所描述的行为,您必须实施一些自定义机制。

此外,您可能会查看 this 答案。这会很有帮助。