Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIBackButton Background Image not appearing

i'm having a problem with my UIBackbutton not appearing and i'm not sure what is causing it.

This is my code for making the back button image, it is in my first ViewController :

UIImage *backButtonHomeImage = [[UIImage imageNamed:@"backButtonImage"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0)];
[[UIBarButtonItem appearance] setBackButtonBackgroundImage:backButtonHomeImage  forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];

When you first enter the next view (done by a segue from a button) the button isn't visible but the text to go back is visible. Once i've hit the back button the image appears and it stays appeared on the next time i click it.

I'm not sure if this is an issue to do with my code, or the file it's in or if it's and iOS 7 problem.

like image 444
Alex Trott Avatar asked Sep 13 '13 11:09

Alex Trott


1 Answers

You may have more luck using a UIBarButtonItem and setting the back button background explicitly.

The appearance proxy has been unreliable in my own attempts to get a back button working with iOS 7. I experienced the same issue with the background not showing up properly first time showing the button.

like image 125
Albert Hafvenström Avatar answered Oct 07 '22 01:10

Albert Hafvenström