Steaphann
Steaphann

Reputation: 2777

JASidepanels not showing navigationbutton

I am trying to implement the JASidePanels in my project using storyboard. You can see my storyboard over here.

enter image description here

The problem is that I don't see the button in the navigationbar to reveal the leftpanel. In my RootViewController I've this in code.

-(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];

}

I've followed the steps that they say on the github page. Also when I try to embed the RootviewController inside a navigationController. It is showing the navigationBar but not the barbutton item.

Any help on this ?

Upvotes: 3

Views: 1924

Answers (2)

Omar Guzmán
Omar Guzmán

Reputation: 19

Well, I'm using swift 2.2 and I couldn't either see the navigation button.

I'm using storyboards; so I created:

  • MainViewController -> this is going to be the main container
  • LeftMenuViewController -> this is the left menu
  • ProductsViewController -> this is going to be inside MainViewController

So in MainViewController, I set up my VC as follows:

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

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

Adding UINavigationController.init will solve the problem, and you will see the navigation button in the center panel.

Upvotes: 0

JOM
JOM

Reputation: 8207

Embed your center UIViewController in storyBoard into UINavigationController, for example:

  1. Select UIViewController on StoryBoard
  2. Select Xcode menu item Editor - Embed In - Navigation Controller
  3. Select new UINavigationController's Identity Inspector (Alt-Command-3)
  4. Give unique name to StoryBoard ID e.g. myCenterController
  5. Use that name to create center panel

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

So you don't actually set viewController as centerPanel, but a navigation controller containing your viewController.

Upvotes: 9

Related Questions