adit
adit

Reputation: 33654

Missing back button when using popToViewController

In my 4th view controller I did the following:

NSArray * viewCtrllr = [self.navigationController viewController];
[self.navigationController popToViewController:[viewCtrllr objectAtIndex:1] animated:YES];

This pops it to the 2nd view controller in stack however I am not seeing the back button. If I just do a regular popViewController then I can see all the view controller with the back button on it. How is this even possible? I am not hiding the back button, double checked on that

Upvotes: 0

Views: 288

Answers (1)

Nekto
Nekto

Reputation: 17877

This line:

[self.navigationController popToViewController:[viewCtrllr objectAtIndex:0] animated:YES];

Pops to root view controller (first). So no any more view controllers are under it and there is no back button.

Upvotes: 1

Related Questions