UINavigationController Right button
Posted
on Stack Overflow
See other posts from Stack Overflow
Published on 2009-08-21T15:57:35Z
Indexed on
2010/04/14
12:23 UTC
Read the original article
Hit count: 382
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.
© Stack Overflow or respective owner