Pergunta

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?

Foi útil?

Solução

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top