簡體   English   中英

在情節提要中更改ViewController

[英]change viewcontroller in the storyboard

有問題,我想使用alloutAccessoryControlTapped方法更改viewcontroller。 但它不起作用。 這是我的代碼:

- (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control
{
    NSLog(@"calloutAccessoryControlTapped");
    Restaurant *location = [view annotation];


//    RestaurantDetail *resdetail = [[RestaurantDetail alloc] init];
    RestaurantDetail *resdetail = [self.storyboard instantiateViewControllerWithIdentifier:@"details"];
    [resdetail setLocation:location];
    [self.view addSubview:resdetail.view];

}

我使用情節提要構建視圖。 該代碼在舊版本中運行良好。 但我想嘗試使用情節提要。 不幸的是,它不起作用。 有人幫我嗎?

如果從一個視圖控制器到另一個視圖控制器創建一個命名的segue並在此處觸發它,則可能會更加幸運。 我認為這可以做更多幕后操作(您可以手動完成,但我不知道有什么用處)。

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM