I am trying to replace the default backBarButtonItem image used by UINavigationControllers in my app. I want to use the following image (actually I am using a white arrow, but that wouldn't show here against the white background):
My image is 60 pixels wide and 33 pixels high, including empty space buffer around the arrow that I want to use to keep the arrow from being stretched too wide.
I've added the following code to my AppDelegate.m
UIImage *barButtonImage = [[UIImage imageNamed:@"icon-navbar-backbutton"] resizableImageWithCapInsets:UIEdgeInsetsMake(0,27,0,0)];
[[UIBarButtonItem appearance] setBackButtonBackgroundImage:barButtonImage forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
The left inset is set to 27 points so that the head of the arrow isn't stretched. But when I run the code, I get the following result in the nav bar:
Why am I getting the extra white piece at the end of my backBarButtonItem?