ios7 setBackButtonBackgroundImage图像仍然被拉伸

ben*_*e89 0 ios

使用以下代码设置全局导航后退按钮图像:

float imageSize = 21.5; // @2x is 43px width

UIImage *barBackBtnImg = [[UIImage imageNamed:@"arrow-back-white"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, imageSize, 0, 0)];

[[UIBarButtonItem appearance] setBackButtonBackgroundImage:barBackBtnImg
                                                  forState:UIControlStateNormal
                                                barMetrics:UIBarMetricsDefault];
[[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(0, -60)
                                                     forBarMetrics:UIBarMetricsDefault];
Run Code Online (Sandbox Code Playgroud)

原始图片:http://cl.ly/XJgD和in-app(被拉伸):http://cl.ly/XKc0

任何想法为什么图像仍在拉伸?

ben*_*e89 10

如果有人有兴趣,这是我的修复:

[[UINavigationBar appearance] setBackIndicatorImage:[UIImage imageNamed:@"arrow-back-white"]];
[[UINavigationBar appearance] setBackIndicatorTransitionMaskImage:[UIImage imageNamed:@"arrow-back-white"]];
[[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];
Run Code Online (Sandbox Code Playgroud)