Reputation: 8108
I am not using any customized bar button items in nav bar, just default title and back button in navigation bar. But in one of my view controller the back button is taking up too much space as highlighted in the image. So it's pushing the Nav Title towards right.
I am not sure what is causing this. Is there anyway to adjust the content inset or width of the back button in ios?
Upvotes: 1
Views: 1031
Reputation: 2189
If you using default Back Button on Navigation bar,add my working code to previous viewController while pushing to nextViewController
self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"" style:UIBarButtonItemStylePlain target:nil action:nil];
And then add title to navigation bar on nextViewController viewDidLoad:
method
[self.navigationItem setTitle:NSLocalizedString(@"Restaurants", nil)];
Handle back button action event from nextViewController like this,
self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"G_Back", nil) style:UIBarButtonItemStylePlain target:nil action:@selector(actionToBackBtnFromDetail:)];
Upvotes: 4