benhowdle89
benhowdle89

Reputation: 37464

ios7 setBackButtonBackgroundImage image is still stretched

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

Answers (1)

benhowdle89
benhowdle89

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

Related Questions