简体   繁体   中英

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. 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?

Any help would be greatly appreciated!

On pushing a viewController using self.navigationController a back button is provided by default. 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;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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