Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/109.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios Swift 3.0注释标注_Ios_Swift_Annotations_Viewdidappear - Fatal编程技术网

Ios Swift 3.0注释标注

Ios Swift 3.0注释标注,ios,swift,annotations,viewdidappear,Ios,Swift,Annotations,Viewdidappear,是否有办法在ViewDid出现时取消注释标注?例如,如果单击注释,则会显示详图索引。但是,将视图控制器切换回地图视图将返回标注仍在其中的注释。我对能够取消标注感兴趣,但我知道这需要操纵annotationView,我不确定如何将其合并到ViewDidAppeare中 在您的视图中使用此代码 我们在选定的注释上循环,并在每个注释上调用deselect for annotation in self.mapView.selectedAnnotations { self.

是否有办法在ViewDid出现时取消注释标注?例如,如果单击注释,则会显示详图索引。但是,将视图控制器切换回地图视图将返回标注仍在其中的注释。我对能够取消标注感兴趣,但我知道这需要操纵annotationView,我不确定如何将其合并到ViewDidAppeare中

在您的
视图中使用此代码

我们在选定的注释上循环,并在每个注释上调用deselect

    for annotation in self.mapView.selectedAnnotations
    {
        self.mapView.deselectAnnotation(annotation, animated: true)
    }

希望这有助于在您的
视图中使用此代码

我们在选定的注释上循环,并在每个注释上调用deselect

    for annotation in self.mapView.selectedAnnotations
    {
        self.mapView.deselectAnnotation(annotation, animated: true)
    }
希望这有帮助