未调用prepareForSegue

发布于 2025-01-08 10:35:08 字数 962 浏览 0 评论 0原文

我正在使用模板主详细信息应用程序。我从 SplitViewController 添加了一个模态转场,并为其指定了标识符“DisplayLoginView”。

我从我的detailViewController中调用以下内容:

- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:YES];
    [self.splitViewController performSegueWithIdentifier:@"DisplayLoginView"    sender:self.splitViewController];
}

我还在detailViewController中定义了prepareForSegue方法:

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    NSLog(@"Source Controller = %@", [segue sourceViewController]);
    NSLog(@"Destination Controller = %@", [segue destinationViewController]);
    NSLog(@"Segue Identifier = %@", [segue identifier]);
    if ([segue.identifier isEqualToString:@"DisplayLoginView"])
    {
        PrometheusLoginViewController *loginViewController = (PrometheusLoginViewController *)segue.destinationViewController;
        loginViewController.delegate = self;
    }
}

知道为什么不调用它吗?

I'm using the template master detail application. I have added a modal segue from SplitViewController and given it the identifier "DisplayLoginView".

I call the following from my detailViewController:

- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:YES];
    [self.splitViewController performSegueWithIdentifier:@"DisplayLoginView"    sender:self.splitViewController];
}

I also have the prepareForSegue method defined in detailViewController:

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    NSLog(@"Source Controller = %@", [segue sourceViewController]);
    NSLog(@"Destination Controller = %@", [segue destinationViewController]);
    NSLog(@"Segue Identifier = %@", [segue identifier]);
    if ([segue.identifier isEqualToString:@"DisplayLoginView"])
    {
        PrometheusLoginViewController *loginViewController = (PrometheusLoginViewController *)segue.destinationViewController;
        loginViewController.delegate = self;
    }
}

Any idea on why it's not called?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦冥 2025-01-15 10:35:08

您要求 splitViewController 执行 segue,但您在detailViewController 中定义prepareForSegue。它们需要位于同一对象上才能触发prepareForSegue。

You're asking the splitViewController to perform the segue, but you're defining prepareForSegue in the detailViewController. They need to be on the same object for prepareForSegue to be triggered.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文