ios – 兩個檢視控制器之間的Segue
在我的故事板上(如上所示),我有一個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,但檢視然後只顯示為一個黑色的螢幕.
>將一個新的導航控制器拖到你的故事板 – 它將由
預設附加到tableview控制器
>刪除tableview控制器右鍵單擊導航
控制器,並將“根檢視控制器”屬性連線到您的
現有檢視控制器
>將入口點箭頭從檢視控制器移動到根
檢視控制器
http://stackoverflow.com/questions/13049668/segue-between-two-view-controllers