In my custom navigation bar, i want to use hide default back button and use my customize left button, but even if the back button is hidden, it sill take some space at the left end of navigation bar.
How to get rid of back arrow button completely?
I have tried to set backBarButtonItem
and 'hidesBackButtonproperties of
UINavigationItem`, but none of these works.
UPDATED:
- (void) viewDidLoad{
//...
self.navigationItem.hidesBackButton = YES;
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:_backButtonView];
//...
}
I use Spark Inspector to inspect the view hierarchy.
As you see, the back arrow button still takes some space in navigation bar.
UPDATED:
The back arrow is actually an instance of _UINavigationBarBackIndicatorView, it look like a private class.
UPDATED:
It turns out the problem have nothing to do with the UINavigationbarBackIndicatorView
. iOS 7 will add spacing before the left item.
this problem is similar to this. Found the answer.