Using segue from MapView calloutAccessoryControlTapped

I am using StoryBoards in my application. I have MKMapView with annotations. I applied the calloutAccessoryControlTapped method and want to go to the TableView when the user clicks on UIButtonTypeDetailDisclosure.

(1) Is there a way to use segue from calloutAccessoryControlTapped?

(2) Without using segue, I get a black screen.

- (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control { ... DetailViewController *detailViewController = [[DetailViewController alloc]init]; detailViewController.detailItem = managedObject; [self.navigationController pushViewController:detailViewController animated:YES]; } 
+6
source share
1 answer

You can simply create a push sega in your storyboard from this view controller to the DetailViewController element. Then give the segue identifier (look in the inspector for the "identifier").

And if the identifier is, say, "presentDetailViewController", then you can simply do this:

 [self performSegueWithIdentifier:@"presentDetailViewController" sender:self]; 

Hope this helps.

+5
source

Source: https://habr.com/ru/post/901382/


All Articles