JASidepanels没有显示导航按钮

时间:2013-03-13 07:45:55

标签: ios iphone objective-c storyboard jasidepanels

我正在尝试使用JASidePanels在我的项目中实现storyboard。你可以在这里看到我的故事板。

enter image description here

问题是我没有看到导航栏中的按钮显示左侧面板。在我的RootViewController中,我在代码中使用它。

-(void) awakeFromNib
{
    [self setLeftPanel:[self.storyboard instantiateViewControllerWithIdentifier:@"leftViewController"]];
    [self setCenterPanel:[self.storyboard instantiateViewControllerWithIdentifier:@"centerViewController"]];
    [self setRightPanel:[self.storyboard instantiateViewControllerWithIdentifier:@"rightViewController"]];
        self.shouldResizeLeftPanel = YES;
    self.shouldResizeRightPanel = YES;
    [self setRightFixedWidth:300.0f];
    [self setLeftFixedWidth:300.0f];

}

我按照他们在github page上说的步骤进行了操作。 当我尝试将RootviewController嵌入navigationController时。它显示的是navigationBar,但不显示barbutton item

对此有何帮助?

2 个答案:

答案 0 :(得分:9)

将故事框中的中心UIViewController嵌入到UINavigationController中,例如:

  1. 在StoryBoard上选择UIViewController
  2. 选择Xcode菜单项编辑器 - 嵌入 - 导航控制器
  3. 选择新的UINavigationController的Identity Inspector(Alt-Command-3)
  4. 为StoryBoard ID指定唯一名称,例如myCenterController
  5. 使用该名称创建中心面板

    [self setCenterPanel:[self.storyboard instantiateViewControllerWithIdentifier:@“myCenterController”]];

  6. 所以你实际上并没有把viewController设置为centerPanel,而是一个包含你的viewController的导航控制器。

答案 1 :(得分:0)

好吧,我正在使用swift 2.2,我无法看到导航按钮。

我正在使用故事板;所以我创建了:

  • MainViewController - >这将成为主要容器
  • LeftMenuViewController - >这是左侧菜单
  • ProductsViewController - >这将在 MainViewController

所以在MainViewController中,我按如下方式设置我的VC:

self.leftPanel = self.storyboard?.instantiateViewControllerWithIdentifier("LeftMenuViewController") //for left menu and

self.centerPanel = UINavigationController.init(rootViewController: (self.storyboard?.instantiateViewControllerWithIdentifier("ProductsViewController"))!)

添加UINavigationController.init将解决问题,您将在中心面板中看到导航按钮。

相关问题