从数组列表中自动打开注释

问题描述:

我试图自动打开所有注释针脚,以便用户不需要实际触摸它们。我自动生成的注解引脚使用这种方法从数组列表中自动打开注释

filteredLocations.map { 
     (location) in 
     let annotation = MGLPointAnnotation() 
     annotation.title = location.Neighborhood 
     annotation.coordinate = CLLocationCoordinate2D(latitude:  location.latitude, longitude: location.longitude) 
     mapView.addAnnotation(annotation) 
     mapView.setCenter((mapView.userLocation?.coordinate)!,zoomLevel:11, animated:true) 
     mapView.selectAnnotation(annotation, animated: true) 

我使用方法mapView.selectAnnotation(注解,动画:真)试过了,但它似乎并没有做任何事情。

您一次可以在iOS中为Google标记显示一个InfoWindow。

mapView.selectedMarker = marker; 

这将打开最后选定标记的信息窗口。 如果您想一次显示多个标记,那么您应该制作包含标记和信息窗口的自定义标记。

希望这对你有帮助。 参考:How to show all Info window in iOS Google maps without tapping on Marker?

+0

这个问题对Google来说可能是正确的,但问题是关于Mapbox。 – friedbunny