简体   繁体   English

导航栏后退按钮弹出视图 Controller

[英]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.

相关问题 尝试创建导航栏后退按钮到选项卡栏控制器视图 - Trying to create a Navigation Bar back button to a Tab Bar Controller view 当我在iPhone的导航栏上单击时,如何弹出所需的视图控制器 - How can i pop to a required view controller when i click on back on navigation bar in iPhone 推送/弹出视图控制器,带有导航栏,来自View Controller,不带导航栏 - Push / Pop View Controller With Navigation Bar from View Controller Without Navigation Bar 如何在导航栏的后退按钮上放置视图? - How to put a view on the back button of navigation bar? 导航栏“后退”按钮以关闭模态视图 - Navigation Bar “back” Button to dismiss Modal View 使用导航栏和后退按钮创建模态视图 - Create a modal view with navigation bar and back button 通过导航按钮返回主视图 controller - Back to main view by button with navigation controller 导航栏在iPhone sdk中的弹出视图控制器上隐藏 - Navigation bar gets hide on pop view controller in iPhone sdk 单击导航栏中的“上一步”按钮时如何设置自定义View Controller? - How to set a custom View Controller when clicking a “Back” button in Navigation Bar? 是否可以隐藏导航栏但在视图控制器上保留后退按钮? 如果是这样怎么办? - Is it possible to hide navigation bar but keep back button on view controller? If so how?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM