问题
I am using the following code to use a custom image for the back indicator in my iOS 7 app:
UIImage *temp = [[UIImage imageNamed:@"back-black-on-black-normal-2"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
[[UINavigationBar appearance] setBackIndicatorImage:temp];
[[UINavigationBar appearance] setBackIndicatorTransitionMaskImage:temp];
The strange thing is, if I use an image that is 22px high (way too small for what we want, by the way), it centers vertically within in the nav bar just fine. Once I start to make it a more reasonable size, however, it gets way off vertically (here it's 44px high, still too small for us but not centering at all, as you can see):

Any help or suggestions greatly appreciated. Thanks.
回答1:
Check button image, is there any unwanted bottom space?
回答2:
Try with the bellow code.
UIImage *temp = [UIImage imageNamed:@"BackBarButton.png"];
self.navigationController.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithImage:temp style:UIBarButtonItemStylePlain target:self action:@selector(back_Clicked:)];
-(void)back_Clicked:(UIBarButtonItem*)loBtn
{
[self.navigationController popViewControllerAnimated:YES];
}
来源:https://stackoverflow.com/questions/21684661/custom-back-indicator-image-in-ios-7-not-vertically-centered