Mahendra Liya
Mahendra Liya

Reputation: 13218

performSegueWithIdentifier and popViewControllerAnimated breaking screen navigation

I have 4 ViewControllers A, B, C, D. I move from A->B->C->D using Push Segues created from Storyboard.

Due to the logic of my app, if the user wants to go back from Screen D, screen C is no longer valid and I redirect the user to Screen C by using performSegueWithIdentifier

The problem starts now - I can't move back from Screen B->A using [self.navigationController popViewControllerAnimated:YES];

I would like to know why is this happening and how can I address such a scenario & fix the navigation?

Upvotes: 0

Views: 1030

Answers (1)

Nikola Kirev
Nikola Kirev

Reputation: 3152

What is the type of segue that you use?

Why don't you use:

- (NSArray *)popToViewController:(UIViewController *)viewController animated:(BOOL)animated

You can access the stack of view controllers using the viewControllers property of UINavigationController.

Here is Apple's documentation on UINavigationController

Upvotes: 1

Related Questions