[英]Navigation Bar Back Button Pop View Controller
When hitting the Back button on a navigation controller, does the view get popped off the stack?当点击导航 controller 上的后退按钮时,视图是否会从堆栈中弹出? 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?有什么我可以通过
NSLog
向我显示堆栈之类的东西吗?
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. viewController 是从堆栈中弹出的。 You can also
NSLog(@"%@", self.navigationController.viewControllers);
你也可以
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.在
- (void)viewWillAppear
和- (void)viewDidAppear
父 viewController 方法中查看差异,如果您不相信 Apple 工程师在这方面做得很好。
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将在导航堆栈中提供 viewcontrollers 数组。您可以在视图消失之前和其他视图出现之后对它们进行 nslog
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.