答えて

8
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil 
    { 
    if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) { 
     // Custom initialization 
    self.title = @"First View Controller"; 

    // this defines the back button leading BACK TO THIS controller 
    UIBarButtonItem *backBarButtonItem = [[UIBarButtonItem alloc] 
     initWithTitle:@"Back" 
     style:UIBarButtonItemStyleBordered 
     target:nil 
     action:nil]; 
    self.navigationItem.backBarButtonItem = backBarButtonItem; 
    [backBarButtonItem release]; 
    } 
    return self; 
} 
+0

ありがとうございました:) – Eyal

0

self.navigationItem.title = @ "短い名前";

0

私は「正しい」答えが何であるか知りたいです。個人的には、最後に使用したコントローラの名前(ルートなど)を変更します。

-(void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated { 
    [super navigationController:navigationController willShowViewController:viewController animated:animated]; 
    UIViewController *root = [self.navigationController.viewControllers objectAtIndex:0]; 
    if (something) 
     root.title = @"Apply"; 
    else 
     root.title = "Root" 
} 

これはすべて同じ点でself.navigationItem.titleと同じです。

0

親ビューコントローラのnavigationItemからbackBarButtonItemをカスタマイズする必要があります。

関連する問題