2
votes

I push new view controller like this.

[self.navigationController pushViewController:resultViewController animated:YES];

but in the resultViewController, i do the same thing like

[self.navigationController pushViewController:resultViewController2 animated:YES];

But I'm not sure I'm doing right. Cuz I think the two navigationController instance should be same.

I know that navigationController is a pointer but not sure those two are pointing same thing.

Cuz to manage view stacks, views should be pushed in one navigationController. Am I right?

Then how do I get the top navigationController from resultViewController class?

or is all process automatic somehow? like by setting pushed viewController's navigationController to self(navigationController pointer) when pushViewController method called? So I can just get self.navigationController and push another new viewController?

1

1 Answers

1
votes

It's automatic. a navigation controller is the same throughout all the views in it's stack. So calling self.navigationcontroller in any of those views would be a pointer pointing to the same navigation controller