2

In my app, the user can push on parameter button on a toolbar who open a modal viewcontroller. He change the language, save and dismiss this viewcontroller. When he return in previous viewcontroller all label, imageview, ect... have change (here how do that, see Mauro Delrio) answer but not the navigation backbutton title. I begin to believe it's not possible to change the title of this button because it is initialized in the viewcontroller still before.

Is there anybody who respond at this problem ?

Thanks

Community
  • 1
  • 1
user1451163
  • 173
  • 1
  • 4

2 Answers2

0

Make another back button and then assign it to the UINavigationItem's backBarButtonItem.

Dustin
  • 6,783
  • 4
  • 36
  • 53
  • I do that when the viewcontroller bind with the backbutton will appear and so when i click on the backbutton. If i click on the backbutton that work, it call the viewwillappear method, but if I not click on it, that stay the old language. – user1451163 Jun 29 '12 at 09:40
0

You can change the title in the -(void) viewWillAppear:(BOOL)animated This method should be called when you dismiss a modal viewcontroller if i remember correctly.

Maverick1st
  • 3,774
  • 2
  • 34
  • 50
  • I tried this solution, i call this method of the viewcontroller what I find in the navigation controller [viewcontroller viewWillAppear:YES] in the viewcontroller what I dismiss (in the viewWillDisappear method) but nothing happens – user1451163 Jun 29 '12 at 10:06
  • OK. So if i understand you correctly you want to switch language of the backbuttons title which should by default be the title of the viewcontroller the backbutton leads to. Or do you simply have written "Back" on your backbutton? I have some code which changes the backbuttons title. I'll dig it out for u and post it when i have found it :) – Maverick1st Jun 29 '12 at 10:24
  • I've the title "Back" on the backbutton and i'd like "Retour", if I choose French language but that change only if I click on the backbutton what I want to change (like say above). See below the code what I use in viewWillAppear of the viewcontroller bound at the backbutton (so, the viewcontroller who appear when i click on the back button what I want to change): backBtn = [[UIBarButtonItem alloc] initWithTitle: [self getLocalizedText:@"WORD_IN_GOOD_LANGUAGE_4_BACK_BTN"] style: UIBarButtonItemStyleBordered target: nil action: nil]; Thanks for your help. – user1451163 Jun 29 '12 at 12:33
  • and of course this, sorry : [self.navigationItem setBackBarButtonItem: backBtn] That work if I click – user1451163 Jun 29 '12 at 12:36
  • Ok, I found. The view controller of the modal page was, in fact, a navigationcontroller what I've put in a main navigationController, so for change all backbutton, i called self.navigationController.viewControllers in modal page but in the modal page, it's not the main navigationController what i called but the navigationcontroller of the modal page :-/ I thought what the navigationController initialized in the app delegate was self.navigationController of all page of app ^^ Sorry and thanks for your help – user1451163 Jun 29 '12 at 16:23