2013-10-26 133 views
0

我正在嘗試推送到另一個視圖控制器,並且我的任何barbuttonitems都不會顯示在我的導航欄上。這是我的代碼:導航欄不會顯示項目

- (void)viewDidLoad 
{ 
    [super viewDidLoad]; 

    NSString *stringMoney1 = self.monier; 
    NSString *stringMoney2 = self.monier2; 

    NSString *appendedMoney = [stringMoney1 stringByAppendingString:stringMoney2]; 

    self.moneyText.text = [NSString stringWithFormat:@"%@", appendedMoney]; 

    self.moneyText.backgroundColor =[UIColor clearColor]; 
    self.moneyText.scrollEnabled = NO; 
    self.moneyText.userInteractionEnabled = NO; 

    self.navigationController.navigationBar.tintColor = [UIColor whiteColor]; 
    self.navigationController.navigationBarHidden = NO; 
    self.navigationController.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName : [UIColor whiteColor]}; 
    self.navigationController.navigationBar.barTintColor = [UIColor redColor]; 
    self.navigationController.navigationBar.translucent = NO; 
    self.title = @"INBOX"; 

    self.moneyLbl.font = [UIFont fontWithName:@"Outstanding" size:8]; 

} 

它可能是我的.xib文件或從我以前的視圖控制器的東西嗎?

任何幫助將不勝感激!

+0

你在哪裏設置BarButtonItems? –

回答

0

在使用self.navigationController推送viewController時,會默認提供後退按鈕。 如果需要額外的導航欄按鈕項目,我們可以添加它們。例如,

 UIBarButtonItem *backButton = [[UIBarButtonItem alloc] 
           initWithTitle:NSLocalizedString(@"Back", @"Back") 
           style:UIBarButtonItemStyleBordered 
           target:self 
           action:@selector(popViewController)]; 
self.navigationItem.leftBarButtonItem = backButton;