简体   繁体   中英

Navigation Bar Not Populated - iOS7

A single view in my application refuses to populate the navigation bar in iOS7. I can see the bar is there, enabled, visible and transparent, because my scrollable controls float underneath it when I drag them up. The issue is simply that when I add controls to self.navigationItem.leftBarButtonItem / self.navigationItem.rightBarButtonItem , and denote the title of the view (in the ViewController) with self.title = @"Title"; they do not show in the navigation area.

The strange thing is if I set self.navigationController.navigationBar.topItem.title = @"Title" , this renders a title on the view in the navigation bar (but is not a solution as it causes problems when navigating elsewhere in the app). The expression " (self.navigationController.navigationBar.topItem != self.navigationItem) " evaluates true, and I do not understand how this can be the case.

There are other views in the application which render navigation controls properly with the statements shown above.

I should mention that this application performs as expected under iOS6.1. I am pretty new to iPhone dev, so could easily have missed something. Any suggestions for what I could check will be appreciated.

Solved. I was using an incorrect method of pushing the view controller into the navigation controller.

Instead of

self.navigationController.viewControllers = [NSArray arrayWithObject:self.myViewController];

Use the following

[self.navigationController pushViewController:self.vehicleListViewController animated:YES];

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