Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using segue from MapView calloutAccessoryControlTapped

Tags:

iphone

ios5

I am using StoryBoards in my app. I have a MKMapView with annotations. I have implemented calloutAccessoryControlTapped method and want to navigate to TableView when user taps on UIButtonTypeDetailDisclosure.

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

(2) Without using segue I am getting 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];
}
like image 397
Vineet Bhatia Avatar asked Nov 13 '11 15:11

Vineet Bhatia


1 Answers

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

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

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

Hope that helps.

like image 149
Firoze Lafeer Avatar answered Oct 29 '22 01:10

Firoze Lafeer