Reputation: 279
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.
Upvotes: 2
Views: 1400
Reputation: 279
I tried the function performseguewithidentifier
on following method:
func mapView(mapView: MKMapView, didSelectAnnotationView view: MKAnnotationView){
// do your things here
}
and it worked fine.
Upvotes: 3