iphone - Setting action for back button in navigation controller -


I am trying to overwrite the back button's default action in the navigation controller. I have provided an action on a custom button for a goal. The strange thing is that when it specifies, though the backbutton attribute does not pay attention to it and it only pops up the current scene and returns to the root:

  UIBarButtonItem * backButton = [ [UIBarButtonItem Alloc] initWithTitle: @ "server" style: UIBarButtonItemStylePlain Target: Self-action: @selector (home)]; Self.navigationItem.backBarButtonItem = backButton;  

As soon as I set it through the left, the barbutitan on the navigation, this is called my action, however, the button looks like a plain round rather than one Is:

  self.navigationItem.leftBarButtonItem = backButton;  

How can I call my custom actions before returning to the root view? Is there a way to overwrite the default back action, or is there a way that is always called when leaving a view (see Dude is not downloaded)?

Try putting it in the view controller where you want to find the press:

  - (zero) view special: (BOOL) animated (if ([Self.navigationController.viewControllers indexOfObject: self] == NSNotFound) {// back button was pressed. We know that this is true Because Self is no longer in the navigation stack} [Super view special: animated];}  

Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -