使用MapView中的segue calloutAccessoryControlTapped

Vin*_*tia 6 iphone ios5

我在我的应用程序中使用StoryBoards.我有一个带注释的MKMapView.我已经实现了calloutAccessoryControlTapped方法,并希望在用户点击UIButtonTypeDetailDisclosure时导航到TableView.

(1)有没有办法从calloutAccessoryControlTapped中使用segue?

(2)没有使用segue我得到一个黑屏.

- (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control {
...    
    DetailViewController *detailViewController = [[DetailViewController alloc]init];
    detailViewController.detailItem = managedObject;
    [self.navigationController pushViewController:detailViewController animated:YES];
}
Run Code Online (Sandbox Code Playgroud)

Fir*_*eer 5

您可以在故事板中从此视图控制器创建一个推送segue到DetailViewController.然后给segue一个标识符(在检查器中查找"标识符").

然后,如果标识符是"presentDetailViewController",那么你可以这样做:

[self performSegueWithIdentifier:@"presentDetailViewController" sender:self];
Run Code Online (Sandbox Code Playgroud)

希望有所帮助.