I wanted to get notification when I clicked on the back button on the UINavigationController item. So, I created a custom UIBarButtonItem
UIBarButtonItem *leftBarButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"SettingsTabTitleKey", @"") style:UIBarButtonItemStyleBordered target:self action:@selector(settingsButtonPushed:)];
self.navigationItem.leftBarButtonItem = leftBarButton;
However, the button that gets displayed is rectangular and does not have the arrow like other back buttons. Is there anyway, I can display the correct back button or any place I can find a .png for it?
To keep the arrow style button, I usually do this instead:
instead of setting leftBarButtonItem.
However this must be done in the viewDidLoad: method of the view controller that pushes the view controller where you want the button to appear. So you’re setting the back button before the next view controller is pushed…
You could also get notified of the back button being pressed by adding some behavior in the view controller’s viewWillDisappear: method.