views:

319

answers:

1

I am unable to set any property of parentController (which is always a UINavigationController in my case) from child views.

e.g. I want to add a button on the navigation bar using following code:

UINavigationController* parentController = (UINavigationController)self.parentViewController;
UIBarButtonItem *addButton = [[[UIBarButtonItem alloc] initWithTitle:@"Something" style:UIBarButtonItemStyleBordered target:self action:@selector(doSomething)] autorelease];

[_parentController.navigationItem setRightBarButtonItem:addButton animated:YES];

This code runs perfectly without errors but I can't see any button added to the navigation bar.

Thanks in advance.

A: 

There is a similar question here that was answered.

Marius Ciocanel