0

i create a tableViewController in this way:

myTableViewController *tableController = [[[myTableViewController alloc] initWithNibName:@"myTableViewController" bundle:nil] autorelease];

// Setto il pulsante per tornare indietro
UIBarButtonItem *tempButton = [[UIBarButtonItem alloc] init];
tempButton.title = @"Back";
self.navigationItem.backBarButtonItem = tempButton;
[tempButton release];

[self.navigationController pushViewController:tableController animated:NO];

then in the tableviewcontroller, making self.navigationItem.BackBarButtonItem.Title = ... it does'nt happen anything, i've seen that the backbutton is = null.

How can i do? i've tried cutting off the creation of button in first code but it's the same.

Vladimir
  • 170,431
  • 36
  • 387
  • 313
marcus
  • 11
  • 1
  • Possible duplicate of http://stackoverflow.com/questions/1449339/how-do-i-change-the-title-of-the-back-button-on-a-navigation-bar – Jeff Ames May 02 '11 at 18:51

2 Answers2

0

Try using a different init method for UIBarButtonItem:

                    UIBarButtonItem *backButton = [[UIBarButtonItem alloc] 
                                               initWithTitle:@"Back"
                                               style:UIBarButtonItemStyleDone 
                                               target:nil 
                                               action:nil];
Rayfleck
  • 12,116
  • 8
  • 48
  • 74
0

Firstly set the action for back button.

  1. Initialization button action when an object is created

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

  1. Directly add target after allocating object for button

[backButton addTarget:nil action:nil];

Anand
  • 2,086
  • 2
  • 26
  • 44