I will try to find out of button click event in custom annotation view.How do it This.In In this not find out of button click event. Give some hint please.
func mapView(_ mapView: MKMapView, didSelect view: MKAnnotationView) {
let overlays = self.mapVW.overlays
self.mapVW.removeOverlays(overlays)
if view.annotation is MKUserLocation
{
// Don't proceed with custom callout
return
}
let customeView = view.annotation as! Artwork
let viewCustome = Bundle.main.loadNibNamed("mapPopUp", owner: nil, options: nil)
let callOutView = viewCustome![0] as! CustomCalloutView
callOutView.lblLocationName.text = customeView.title
callOutView.lblCategory.text = customeView.category
callOutView.lblDistance.text = customeView.distance
let button = UIButton(frame: callOutView.lblLocationName.frame)
button.addTarget(self, action: #selector(GayGuideViewController.btnRouteView(sender:)), for: .touchUpInside)
callOutView.addSubview(button)
callOutView.center = CGPoint(x: view.bounds.size.width / 5, y: -callOutView.bounds.size.height*0.52)
view.addSubview(callOutView)
mapVW.setCenter((view.annotation?.coordinate)!, animated: true)
}
Thanks in advance.