سؤال

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?

هل كانت مفيدة؟

المحلول

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];
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top