0

I have UINavigationController with 3 views. In case the session with the server is expired then I launch(with the presentViewController) a second navigation controller which ask the user to login. If the login was successful then I dismiss the login navigation controller. The problem is that I want to know which view in the navigation controller launched the login NC because i want to execute the viewDidAppear. I tried to differentiate each view in the first NC by the title. I am thinking to get the title of the VC which presented the login NC and then get a pointer on it and execute the viewDidAppear. This is my code in the login NC after a successful login:

[self dismissViewControllerAnimated:YES completion:^{

    UINavigationController *viewConNav = (UINavigationController *)self.parentViewController;
    NSLog(@"%@",viewConNav.topViewController.title);

}];

but I get null. (Yes I set the title in the storyboard)

EDIT: Actually I want to get the NC under the presented NC.

rmaddy
  • 314,917
  • 42
  • 532
  • 579
BlackM
  • 3,927
  • 8
  • 39
  • 69

1 Answers1

0

self.presentingViewController should have the right VC for you.

Instead, you should probably use:

[self.presentingViewController dismissViewControllerAnimated:YES];
russellm
  • 155
  • 7