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?

有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top