导航栏不会显示项目

时间:2013-10-26 06:20:23

标签: ios objective-c

我正在尝试推送到另一个视图控制器,我的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文件或我以前的视图控制器中的某些内容吗?

非常感谢任何帮助!

1 个答案:

答案 0 :(得分:0)

在使用self.navigationController推送viewController时,默认情况下会提供一个后退按钮。 如果需要其他导航栏按钮项,我们可以添加它们。例如,

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