简体   繁体   English

后退按钮的调用方法

[英]Calling method on back button

I have a navigation controller that has a hidden navigation bar on the first view, and then appears for all children views. 我有一个导航控制器,在第一个视图上有一个隐藏的导航栏,然后对所有子视图都显示。 Problem is, I can't seem to hide it again if you go back to the first view. 问题是,如果您回到第一个视图,我似乎无法再次将其隐藏。

I created a back button (so I could rename it) in the first view's init: 我在第一个视图的init中创建了一个后退按钮(以便可以重命名):

self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] 
  initWithTitle:@"Logout" style:nil target:self 
  action:@selector(hideNavigationBar:)];

But the method never gets called. 但是该方法永远不会被调用。 Why? 为什么?

在第一个控制器的-(void)viewWillAppear ,说:

  [self.navigationController setNavigationBarHidden:YES animated:NO];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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