如何隐藏在MapView中单击AnyWherWher
的自定义宣传视图我已经使用了TouchSbegan方法,但是当单击PIN区域时它无法正常工作。
无需使用touchesbegan方法,mapView已经具有didDeSelect方法来隐藏注释视图。
func mapView(_ mapView: MKMapView, didDeselect view: MKAnnotationView) {
if view.isKind(of: AnnotationView.self)
{
for subview in view.subviews
{
subview.removeFromSuperview()
}
}
}