I am trying to integrate the pkrevealcontroller sliding menu into an existing iOS project that has an existing storyboard with segues, etc. I extended UINavigationViewController and linked my new class to the Nav Controller on the storyboard. In my app delegate I do the following:
MainNavViewController *frontViewController = [[MainNavViewController alloc] initWithRootViewController:[[myRootViewController alloc] init]];
UIViewController *rightViewController = [[menuViewController alloc] init];
self.revealController = [PKRevealController revealControllerWithFrontViewController:frontViewController
rightViewController:rightViewController
options:nil];
self.window.rootViewController = self.revealController;
When I run the application, it successfully adds the sliding menu icon to the navigation bar, and the frontview slides as I want it. But it is not using the title or segues I have added on the storyboard. Is what I'm trying even possible.
My app delegate does not have the
revealController
variable so had to create that manual, is that something you have to do?I think the problem is that you're instantiating a new frontViewController -- that's not the one that's in your storyboard. I'm not exactly sure how to do this, but I would try it like this. I would add a UIViewController in the storyboard -- change its class to PKRevealController, and make it the initial controller in the storyboard, but don't hook it up to the rest of the scenes. Give your MainNavViewController an identifier in IB, then change the code in your app delegate to this:
In Swift use this,