Adding a button to MKPointAnnotation?

前端 未结 1 1824
旧时难觅i
旧时难觅i 2021-01-29 01:34

I just wrote few lines of code and got stuck trying add a detail button to my annotation point, I don\'t know how. Does anyone know how to do that? The image below shows what I

相关标签:
1条回答
  • 2021-01-29 02:09

    I do not have access to your second image url but I assume you are looking something as follows. If not, leave comment below.

      func mapView(mapView: MKMapView!, annotationView: MKAnnotationView, calloutAccessoryControlTapped control: UIControl) {
    
            if control == annotationView.rightCalloutAccessoryView {
                performSegueWithIdentifier("Detail", sender: self)
            }
        }
    

    You could also refer to the following examples:

    • MKPointAnnotations touch event in swift

    • MapKit in Swift, Part 2

    • http://www.raywenderlich.com/90971/introduction-mapkit-swift-tutorial
    0 讨论(0)
提交回复
热议问题