简体   繁体   中英

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:

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];

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