It always occurs when you are using the table view controller in your iOS Xcode project & when you navigate from the table view cell to the detail view of your app in the storyboard on the iOS Simulator or the actual device, the ‘Back,’ button Appears at the top left. What if you want to add a button beside the ‘Back’ button, And you want to know how? Here is the solution,
You have to add the following code in your ‘viewdidLoad’ function in your desired ViewController.m file:
self.navigationItem.leftItemsSupplementBackButton = YES;
And supplement above code with the following code to call button:
UIBarButtonItem *share = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction target:self action:@selector(shareAction)];
self.navigationItem.leftBarButtonItems = [self.navigationItem.leftBarButtonItems arrayByAddingObject:share];
Now your viewDidLoad function should look like this:
- (void)viewDidLoad
{
NSLog(@"viewDidLoad");
[super viewDidLoad];
// Do any additional setup after loading the view.
self.navigationItem.leftItemsSupplementBackButton = YES;
UIBarButtonItem *share = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction target:self action:@selector(shareAction)];
self.navigationItem.leftBarButtonItems = [self.navigationItem.leftBarButtonItems arrayByAddingObject:share];
}
Hope it helps,
Thanks & Regards
Mandar Apte