I am creating a simple point annotation with a callout inside the UITapGestureRecognizer
delegate.
The first time I tap on the map, the pin appears with the callout but the callout immediately disappears after that.
The second time I tap on the same pin, the callout appears and stays there, not sure why it disappears at the first time.
@IBAction func handleMapTouch(recognizer: UITapGestureRecognizer){
let view = recognizer.view
let touchPoint=recognizer.locationInView(view)
var touchCord=CLLocationCoordinate2D()
touchCord = mapView.convertPoint(touchPoint, toCoordinateFromView:
mapView)
mapView.removeAnnotations(mapView.annotations)
pointAnnotation.coordinate=touchCord
pointAnnotation.title="ABC"
pointAnnotation.subtitle="DEF"
mapView.addAnnotation(pointAnnotation)
mapView.selectAnnotation(pointAnnotation, animated: true)
}