Reputation: 37464
Using the following code to set a global navigation back button image:
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];
Original image: http://cl.ly/XJgD and in-app (being stretched): http://cl.ly/XKc0
Any ideas why the image is still being stretched?
Upvotes: 0
Views: 1053
Reputation: 37464
If anyone is interested, this was my fix:
[[UINavigationBar appearance] setBackIndicatorImage:[UIImage imageNamed:@"arrow-back-white"]];
[[UINavigationBar appearance] setBackIndicatorTransitionMaskImage:[UIImage imageNamed:@"arrow-back-white"]];
[[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];
Upvotes: 10