You need to change the title of the "back" button to "Back" in the next controller. I use the following in prepareForSegue before calling the controller via segue:

-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if ([[segue identifier] isEqualToString:@"showSaveProductDifficultTVC"]) { UIBarButtonItem *backButton = [[UIBarButtonItem alloc]initWithTitle:NSLocalizedString(@"Назад", returnbuttontitle) style: UIBarButtonItemStylePlain target:nil action:nil]; self.navigationItem.backBarButtonItem = backButton; } 

In the end, instead of "Back" I have shown "back". This happens only with the word "Back" or other Russian words, if you use any nonsense, for example, @b, then everything is fine.

enter image description here enter image description here

What could be the problem.

Addition:

The problem in my case was that the application tested on the iPhone 4S, where the navigationItemBar did not include the Back, Save and title buttons. And if you shorten the title or the name of the navigationItemBar buttons, or expand the device, then everything is fine.

enter image description here enter image description here enter image description here

  • And if you reduce the font a little. - Orest Mykha
  • It just seems more like a bug, since it would be more logical to display the title not fully, like this: complex pro ... After all, this is what happens when you create a button back in the code or storyboard. - Alex Burov
  • Perhaps a bug. - Orest Mykha

4 answers 4

You don’t need to programmatically create a "back" button with different localization. The system does it herself.

Only in your case is it necessary to change the basic internationalization.

By default, your info.plist has:

Localization native development region = en

Because of this, instead of "Back" shows "Back". Change to ru and there will be a "Back"

You can add language support to the project and uncheck the box "Use Base Internatialization". The button text will change depending on the device language.

enter image description here

In this case, if the title is long, the text "Back / Back" will not be.

ps The button can also easily set the color / font / size and change the indicator.

    Move the title change code to the viewDidLoad method of the controller you need

    Update:

     - (void)viewDidLoad { [super viewDidLoad]; UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle:@"Назад" style:UIBarButtonItemStylePlain target:self action:@selector(onBackButtonTapped:)]; self.navigationItem.leftBarButtonItem=newBackButton; } -(void) onBackButtonTapped:(UIBarButtonItem *)sender { [self.navigationController popToRootViewControllerAnimated:YES]; } 
    • Yes, it changes the title of the button, but with the change of the string self.navigationItem.backBarButtonItem = backButton; on self.navigationItem.leftBarButtonItem = backButton; And the main button does not make the transition back. - Alex Burov
    • In addition, this code in segue works fine in other controllers in the same application. - Alex Burov
    • When you change to leftBarButtonItem you also need to specify a selector for a new button. Sample code in response! - Vitali Eller

    Change the font in the navigation bar as follows:

     NSDictionary *size = [NSDictionary dictionaryWithObjectsAndKeys:[UIFont fontWithName:@"Arial" size:17.0],NSFontAttributeName, nil]; self.navigationController.navigationBar.titleTextAttributes = size; 

    Further, when you change the orientation, you can return it back, you can also change the font only if the title of the return button corresponds to "Back."

    By the way, you can set in the storyboard the text of the return button in the RootViewController in the Navigation Item once, and it will be distributed to the entire Navigation Controller: Title back button

      It's safer to make your back button and put it as .leftBarButtonItem . The back button is made by the system, so it can change at any time. With your button this will not happen.

      UIBarButtonItem * backButton = [[UIBarButtonItem alloc] initWithTitle: @ "Back" style: UIBarButtonItemStylePlain target: self action: @selector (barButtonBackPressed :)]; self.navigationItem.leftBarButtonItem = backButton;

      • Try to write more detailed answers. Explain what is the basis of your statement? - Nicolas Chabanovsky