我在我的应用程序中使用 Storyboard。我有一个带注释的 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];
}
最佳答案
您可以在 Storyboard中创建一个从该 View Controller 到 DetailViewController 的推送序列。然后给segue一个标识符(在检查器中查找“标识符”)。
然后,如果标识符是“presentDetailViewController”,那么您可以这样做:
[self performSegueWithIdentifier:@"presentDetailViewController" sender:self];
希望有帮助。
关于iphone - 从 MapView calloutAccessoryControlTapped 使用 segue,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8112515/