Search code examples
iphonecocoa-touchios4mkmapviewmkannotation

How to switch to another view on click of annotation pin in MKMapView in iPhone SDK?


I am making an iPhone app where in there is a requirement of a map.

I am using MKMapView for that. I have placed an annotation at a particular point.

I want that when I click that annotation pin then it should take me to another view controller.

How can I do this? I am new in this MKMapView.


Solution

  • If you want to go to another viewcontroller by clicking the pin directly. There is this delegate of MapView

    - (void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)view
      {
         // Here push your view controller
      }