darksky
darksky

Reputation: 21069

Navigation Bar Back Button Pop View Controller

When hitting the Back button on a navigation controller, does the view get popped off the stack? If so, how can I test that or make sure that it does it correctly (in other words, created a proper navigation controller)?

I need to see if the view is actually getting popped. Is there anything I can NSLog that shows me the stack or something?

Thanks,

Upvotes: 0

Views: 1809

Answers (3)

sujith1406
sujith1406

Reputation: 2822

NSLog(@"%@", self.navigationController.viewControllers); would give the viewcontrollers array in navigation stack.you can nslog them before the view disappears and after the other view appears

Upvotes: 0

Mihai Fratu
Mihai Fratu

Reputation: 7663

The viewController is getting popped from the stack yes. You can also NSLog(@"%@", self.navigationController.viewControllers); in - (void)viewWillAppear and - (void)viewDidAppear methods of the parent viewController to see the differences if you don't trust that Apple engineers did a good job with it.

Upvotes: 0

PengOne
PengOne

Reputation: 48406

Yes, the view is popped from the stack. You can check the size of the stack (number of views) to confirm this.

Upvotes: 1

Related Questions