Question

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.

Was it helpful?

Solution

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];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top