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 table开发者_C百科viewcontroller, 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.
Try using a different init method for UIBarButtonItem:
UIBarButtonItem *backButton = [[UIBarButtonItem alloc]
initWithTitle:@"Back"
style:UIBarButtonItemStyleDone
target:nil
action:nil];
Firstly set the action for back button.
- Initialization button action when an object is created
UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle:@"Back" style:UIBarButtonItemStyleDone target:nil action:nil];
- Directly add target after allocating object for button
[backButton addTarget:nil action:nil];
精彩评论