Reputation: 3392
I am trying the following code in viewDidLoad{} to supplant a custom 'home' button where the stock 'back' button in the nav controller is for two views.
UIImage *image1 = [UIImage imageNamed:@"btn-home-hd.png"];
[[UIBarButtonItem appearance] setBackButtonBackgroundImage:image1 forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
Problem is, the word 'Back' is still showing up under the new image. The image is a lil house so we just want that image to show up, nothing under it. I tried putting a blank space in for 'back button' for this particular view in the storyboard
I see lots of articles with this code in it, but no one is mentioning that the word 'back' is still showing up... why? Does this code need to be further upstream in some init somewhere?
Upvotes: 4
Views: 470
Reputation: 11236
I don't know if this is the recommended strategy, but the way I've solved this is to move the text offscreen. E.g.
[[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(-100, -100) forBarMetrics:UIBarMetricsDefault];
Upvotes: 2