0

I am using leftBarButtonItems to group a negativeSeparator (to get rid of padding and align my custom button to the edge of the screen) and a custom UIBarButtonItem:

[navigationItem setLeftBarButtonItems:@[negativeSeperator, leftButton]];

How do I make my custom leftButton function as a backBarButtonItem? I understand that as soon as I use leftBarButtonItems, it hides/replaces the backBarButtonItem. So, how can I "transfer" the back button functionality to my custom button?

artooras
  • 6,315
  • 9
  • 45
  • 78

1 Answers1

0

Set the action to the leftBarButton item you are placing on the navigationBar and add the below code in that action method

[self.navigationController popViewControllerAnimated:YES];
Sharanya K M
  • 1,805
  • 4
  • 23
  • 44
  • Thanks for you answer. I probably should have mentioned that I want to implement this by not having to make method calls (because I would then have to do it on every viewController). I know I can set leftBarButtonItem to be backBarButtonItem. But can I set leftBarButtonItems (probably not as it's an array) or a button in that array to be backBarButtonItem? – artooras Jun 20 '13 at 11:15
  • 1
    Thanks, I'll just create these simple methods in each view controller then – artooras Jun 25 '13 at 17:52