获取聚集的注释

Get annotations which were clustered

有什么方法可以从 func mapView(_ mapView: MKMapView, didSelect view: MKAnnotationView) 中的集群获取注释吗?

我正在使用 FBAnnotationClusteringSwift 库。

func mapView(_ mapView: MKMapView, didSelect view: MKAnnotationView) {
        print(view)

        if view is FBAnnotationClusterView {
            // TODO : What would be now ?
        } else {
            let ann = view.annotation as! FBAnnotation
            let selected = dicAnnotations[ann]

            performSegue(withIdentifier: "detailSegue", sender: selected)

        }
    }

使用单个注释问题不大,只是简单地要求注释的视图,但找不到任何可以帮助我的东西。顺便提一句。 dicAnnotations 是一个字典 [FBAnnotation, MyObjectType] - 这就是我如何在注释中隐藏选定的项目。

提前致谢!

回答

在深入研究库代码后,我发现我需要 = 要从集群中获取注释,我们需要将此 let anns = view.annotation as! FBAnnotationCluster 放在 if 语句中! 不好意思问!希望它能帮助别人。