1

i've been trying to display a view controller when I tap on a pin annotation of my map View: The first time I used a container view and change his position in order to "hide" it. Than, when I tap on an annotation I used the func mapView(mapView: MKMapView, didSelectAnnotationView view: MKAnnotationView){} to move the position of the view controller that I want to display to the center of my screen. Unfortunately I wasn't able to close the view controller because when I tried to use the function dismissViewController.... It dismiss all the view controllers of my app. So I trie to move the position of the view controller that I want to display a when the user touch the close button, it works only one time, if I tap on an other annotation, the view controller won't show up. I can't do with segue because the annotation aren't shown in the main.storyboard To resume, my question is: How can I display a second View Controller by touching an annotation on my map.

1 Answer 1

2

I tried the function performseguewithidentifier on following method:

func mapView(mapView: MKMapView, didSelectAnnotationView view:  MKAnnotationView){
    // do your things here
} 

and it worked fine.

1
  • This answer saved me at least couple of hours. Thanks.
    – viral
    Oct 7, 2016 at 11:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.