My setup
In a main storyboard i'm using a SWRevealViewController for a sidebar with links to different sections.
Each section is represented in a separated storyboard linked in the main storyboard with RBStoryboardLink.
If in the child storyboards i perform segues to scenes the main navigation controller it's able to represents this putting the destination scene title and a back button. At this point all works well.
An aproximation to the schema is:
-SWRevealViewController
|-> (SWRevealViewControllerSegue) -> sw_front
|-> (SWRevealViewControllerSegue) -> sw_rear
-(sw_rear)UITableViewController
|(each row selection)
|-> SWRevealViewControllerSegue -> (CommonContainer)
-CommonContainer
|-> Container -> Embed segue for container -> RBStoryboardLink
- RBStoryboardLink
|->(User defined runtime attributes) "storyboardName" : "target_storyboard"
-SpecfificControllerOfTargetedStoryboard
-(void)viewDidLoad{
UIBarButtonItem * button = //...
self.topViewController.navigationItem.rightBarButtonItem = button;//DOESN'T WORK
My problem
I can't add rightBarButtonItems to the main navigation bar from the child storyboards.
What i have tried but without success
Dynamically add barbuttons using singleton
I had made the main navigationcontroller a singleton with a method for add a button passed from the child scenes of the differents storyboards.
- (void) addRightButton:(UIBarButtonItem *) button{
self.topViewController.navigationItem.rightBarButtonItem = button;
}
This only works at the first time, even when on the menu the root scene is called.
Narrow the main navigationbar
The worst solution, also don't work. I'm not able to change the main navigationbar width in order to reveal the child scenes top buttons.