문제

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