【问题标题】:JASidepanels not showing navigationbuttonJASidepanels 不显示导航按钮
【发布时间】:2013-03-13 07:45:54
【问题描述】:

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

问题是我在导航栏中没有看到显示左侧面板的按钮。在我的 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 中时。它显示的是导航栏,但不是 barbutton item

这方面有什么帮助吗?

【问题讨论】:

    标签: ios iphone objective-c storyboard jasidepanels


    【解决方案1】:

    将你在storyBoard中的中心UIViewController嵌入到UINavigationController中,例如:

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

      [self setCenterPanel:[self.storyboard instantiateViewControllerWithIdentifier:@"myCenterController"]];

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

    【讨论】:

      【解决方案2】:

      嗯,我使用的是 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 即可解决问题,您将在中心面板中看到导航按钮。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2013-01-20
        • 2020-08-19
        • 1970-01-01
        • 2017-11-06
        • 1970-01-01
        • 2019-04-18
        相关资源
        最近更新 更多