【发布时间】:2014-07-27 16:00:19
【问题描述】:
我的设置
在主情节提要中,我使用SWRevealViewController 作为带有不同部分链接的侧边栏。
每个部分都表示在一个单独的故事板中,并在主故事板中使用RBStoryboardLink链接。
如果在子情节提要中,我对主导航控制器的场景执行 segues,它能够表示这个放置目标场景标题和后退按钮。此时一切正常。
架构的近似值是:
-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
我的问题
我无法将 rightBarButtonItems 从子情节提要添加到主导航栏。
我尝试过但没有成功
使用单例动态添加条形按钮
我已将主导航控制器设置为单例,其中包含添加从不同情节提要的子场景传递的按钮的方法。
- (void) addRightButton:(UIBarButtonItem *) button{
self.topViewController.navigationItem.rightBarButtonItem = button;
}
这仅在第一次有效,即使在菜单上调用根场景时也是如此。
缩小主导航栏
最糟糕的解决方案,也不起作用。我无法更改主导航栏宽度以显示子场景顶部按钮。
【问题讨论】:
标签: objective-c ios7 uinavigationcontroller swrevealviewcontroller