views:

714

answers:

2

So, In our appDelegate we're all used to creating a uinavigationcontroller outlet and linking it to a uinavigationcontroller in the XIB.

However in subsequent viewcontrollers I can only add uibarbuttonitems programatically by accessing the uinavigationcontroller. Is there a way to add buttons to applications uinavigationcontroller in the other uiviewcontroller's XIBS?

Apple seems to do it in this example: http://developer.apple.com/iphone/library/samplecode/EditableDetailView/index.html

The same question has been asked before in apple's forum but remains unanswered.: http://discussions.apple.com/thread.jspa?messageID=8917480#8917480

Thanks,

Dan

A: 

Have you tried dragging a Navigation Bar to a view in the View Controller's NIB? That will create a Navigation Bar with a Navigation Item under it. You can then create a connection between the navigationItem outlet in your File's Owner (whose class should be set to your View Controller class) and the Navigation Item, which is "under" the Nav Bar.

Martin Gordon
Thanks Gordon - I've just tried that and it creates two navigation bars. The one created in my app delegate and the one created in my Xib.. any ideas? Thanks.
Dan Morgan
A: 

if you call [self.navigationController presentModalViewController:YourViewControllerObject animated:YES];

then you will get only one but if you are pushing viewController you'll get two.So either hide the root navigationController's NavigationBar or use presentModalViewController.

Rahul Vyas