[英]Tap gesture for MapKit
Currently I have a map that has several Annotations
. 目前我有一个有几个Annotations
的地图。
For the Annotations
I have 对于我有的Annotations
func mapView(_ mapView: MKMapView, didSelect view: MKAnnotationView){
// Do your annotation click work
}
Is it possible to do this for tapping the Map only and not the Annotation
and how can I do it? 是否可以这样做才能点击Map而不是Annotation
,我该怎么做?
In ViewWillAppear
method : 在ViewWillAppear
方法中:
let gestureRecognizer = UITapGestureRecognizer(target: self, action:"triggerTouchAction:")
mapView.addGestureRecognizer(gestureRecognizer)
And Whatever information you want to show just add code in following method : 无论您想要显示什么信息,只需按以下方法添加代码:
func triggerTouchAction(gestureReconizer: UITapGestureRecognizer) {
//Add alert to show it works
}
Hope it going to help you to resolve issue. 希望它能帮助您解决问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.