Search code examples
iphoneiosobjective-cuibuttonback

iPhone Back button text iOS5+ not showing up?


i have loaded a custom back button with [uibarbutton appearance] but i dont know how to alter the text on the custom image. The code:

- (void)viewDidLoad
{
[super viewDidLoad];

[[UIBarButtonItem appearance] setBackButtonBackgroundImage:[UIImageimageNamed:@"someimage.png"] forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
}

Solution

  • not required to set title or text for it, navigation system of ios it does itself, only you have to assign your custom button to navigation bar's backbutton

    UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle:@"Back" style:UIBarButtonItemStyleDone target:nil action:nil];
    self.navigationItem.backBarButtonItem = backButton;