【发布时间】:2012-10-24 12:55:56
【问题描述】:
在我的故事板上(如上所示),我有一个 ViewController,它包含一个带有注释的 MKMapView。这些注释包含一个显示图标,当点击它时,应该将用户导航到另一个 ViewController。为此,我在视图控制器之间创建了一个 push segue。然后我给它一个标识符“showDetail”并实现了以下代码。
- (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control
{
[self performSegueWithIdentifier:@"showDetail" sender:self];
}
但是我收到以下错误。
Could not find a navigation controller for segue 'showDetail'. Push segues can only be used when the source controller is managed by an instance of UINavigationController.'
我哪里错了?我尝试将源 UIViewController 更改为 UINavigationController,但视图随后显示为黑屏。
【问题讨论】:
-
你能用两个 ViewController 发布你的故事板的截图吗?
-
@Mariusz 问题已更新!谢谢。
-
尝试将你的目标 ViewController 嵌入到 NavigationController 中,然后将你的 segue 从 MapViewController 拖到 NavigationController。
标签: ios ios6 uistoryboard