简体   繁体   中英

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,

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

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM