为什么在移动动画时无法选择annotationView

时间:2019-01-18 07:58:55

标签: ios swift annotations uiviewanimation mkannotation

执行动画时,我尝试单击移动的annotationView,但是无法选择,mapView(_ mapView: MKMapView, didSelect view: MKAnnotationView)尚未被调用

func addMoveAnimation() {
        guard let ano = annotation as? Annotation else {
            return
        }
        animator = UIViewPropertyAnimator.init(duration: 10, curve: .linear, animations: {
            ano.coordinate = CLLocationCoordinate2D(latitude: 32.449819, longitude: 112.292726)
        })
        animator?.startAnimation()
        animator?.addCompletion({ (position) in
            print(position.des,"coor:", ano.coordinate)
        })
    }

1 个答案:

答案 0 :(得分:0)

我尝试为注解视图添加一个UITapGestureRecognizer,它确实可以工作,但是很快就被删除了,并且mapView(_ mapView:MKMapView,didDeselect view:MKAnnotationView)也被称为

;