简体   繁体   English

导航栏将不显示项目

[英]Navigation Bar won't show items

I'm trying to push to another view controller and none of my barbuttonitems will show up on my navigation bar. 我正在尝试推送到另一个视图控制器,并且我的barbuttonitems都不会显示在导航栏中。 Here's my code: 这是我的代码:

- (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];

}

Could it possibly be something in my .xib file or from my previous view controller? 可能是我的.xib文件中或以前的视图控制器中的内容吗?

Any help would be greatly appreciated! 任何帮助将不胜感激!

On pushing a viewController using self.navigationController a back button is provided by default. 使用self.navigationController推送viewController时,默认情况下会提供一个后退按钮。 If additional navigationbar button items are required we can add them. 如果需要其他导航栏按钮项,我们可以添加它们。 For Example, 例如,

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM