【问题标题】:change viewcontroller in the storyboard更改情节提要中的视图控制器
【发布时间】:2011-12-23 00:28:34
【问题描述】:

有问题,我想用 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];

}

我使用故事板来构建视图。这段代码在旧版本中运行良好。但我想尝试使用故事板。不幸的是,它不起作用。有人帮我吗?

【问题讨论】:

    标签: iphone ios5 mapkit storyboard


    【解决方案1】:

    如果您创建从一个视图控制器到另一个视图控制器的命名 segue 并在此处触发它,您可能会更幸运。我认为这可以做更多的幕后工作(您可以手动进行,但我不知道所有这些都是什么)。

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-06-21
      • 1970-01-01
      • 2018-05-18
      • 2014-08-12
      • 1970-01-01
      • 1970-01-01
      • 2018-07-16
      相关资源
      最近更新 更多