0
votes

1) Currently in my app i have tried to implement side menu using
SWRevealViewController downloaded from https://github.com/John-Lluch/SWRevealViewController.

2) Reveal View controller storyboard file is class of SWRevealViewController, which i have imported in my project SWRevealViewController.h and .m.

3)Reveal View controller storyboard file to tableviewcontroller & navigation controller there is segue name reveal view controller set controller.

4)last view controller storyboard file is class of view controller with
UIBarButtonItem *barButton

Here is my code in viewcontroller.m

#import "SWRevealViewController.h"

 - (void)viewDidLoad 

{

 [super viewDidLoad];

SWRevealViewController *revealViewController = self.revealViewController;
if ( revealViewController )
{
    _barButton.target = self.revealViewController;
    _barButton.action = @selector(revealToggle:);
    [self.view addGestureRecognizer:self.revealViewController.panGestureRecognizer];
}

}

5) When i am running my app, there is black screen in simulator, where i need actually bar button with side menu.

6) Storyborad have only 4 files

1.revealViewController connected to tableview controller (using reveal view controller set controller segue)

2.revealViewController connected to navigation controller(using reveal view controller set controller segue)

3.navigation controller to Viewcontroller (using root view controller segue)

6) My files are SWRevealViewController.h &.m, ViewController.h&.m, AppDelegate.h&.m, tableviewcontroller.h&.m

To implement side menu, i referred this http://www.appcoda.com/ios-programming-sidebar-navigation-menu/ IOS: Storyboard and side menu as facebook app

3

3 Answers

2
votes

Please make sure to set SWSegueFrontIdentifier and SWSegueRightIdentifier segue identifiers in storyboard. These two identifiers are declared in SWRevealViewController as

static NSString * const SWSegueRearIdentifier = @"sw_rear";
static NSString * const SWSegueFrontIdentifier = @"sw_front";

You should create two segues for front view controller and rear view controller from SWRevealViewController (which is initial view controller in storyboard). And set respective segue identifiers.

1
votes

The mistake i was doing in storyboard segue naming

1.revealViewController connected to tableview controller (using reveal view controller set controller segue)

2.revealViewController connected to navigation controller(using reveal view controller set controller segue)

The right solution to both of above is, storyboard segue should be custom segue under the segue class of SWRevealViewControllerSegueSetController. Then it worked for me.

0
votes

Does your log say anything?

Black screen is usually a missing initial view controller.

Make sure that you have picked the view controller, that you want to be your initial view controller, and checked the check box ("Is initial View Controller") in your storyboard editor.