I have a UINavigationController
loading in the first tab of a UITabBarController
. I'd like add a refresh button on the right side of the UINavigationItem
. My dim understanding is that one has to set properties like titles and buttons on a nav controller before it's added to the control hierarchy. I have no problem adding buttons to the child navigation controller, but I'm stumped by how to change the root, since it's loading from the nib.
So in the IB screencap below (oops, not enough reputation points, let me try to diagram this....), I'm trying to add a refresh button to the selected item.
- File's Owner
- First Responder
- App Delegate
- Window
- Tab Bar Controller
- Tab Bar
- Observation List View Controller
- Navigation Bar
- View Controller
- Table View
- Navigation Item
- Tab Bar Item
- Another List View Controller
- etc.
- etc.
I've tried to add the button in the navigationController's
viewDidLoad
, with no help:
- (void)viewDidLoad {
[super viewDidLoad];
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh
target:self
action:@selector(refresh:)];
}
I've also tried to programmatically add my ObservationListViewController
to the UITabBarController
, and insert the button in that block, but I'm way out of my depth.
Any idea how I could inject adding a button into the process of loading a nav controller from the nib?
Thank you!