2017-07-13 67 views
0

有没有办法在viewDidAppear上关闭注释标注?例如,如果我点击一个注释,标注就会出现。但是,将视图控制器切换回mapView会返回标注,并且标注仍然存在。我有兴趣能够解除标注,但我知道这需要操作annotationView,我不知道如何将其纳入viewDidAppear。Swift 3.0注释关闭标注

回答

2

使用此代码在您的viewDidAppear

我们周期在选定的注释,并呼吁取消对每一个

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

希望这有助于