John-Lluch / SWRevealViewController

A UIViewController subclass for presenting side view controllers inspired on the FaceBook and Wunderlist apps, done right !
Other
4.52k stars 989 forks source link

UIStoryBoard Issue #696

Open kishorehvk opened 7 years ago

kishorehvk commented 7 years ago

Hi,

I created menu view using your Library SWRevealViewController. So instead of dismiss ViewController I am using UIStoryboard to Instantiate particularView Controller. But when I click back Button that contains UIStoryboard it returns to particularView Controller but menu view is giving error. if ( revealViewController ) { [self.menuButton setTarget: self.revealViewController]; [self.menuButton setAction: @selector( revealToggle: )]; [self.view addGestureRecognizer:self.revealViewController.panGestureRecognizer];

    } else{
    printf("error");
}

When I open the app the menu items are coming in the tableview. When I use back button with UIStoryboard it prints error.

Can U rectify this for me. thanks in advance.

iDevelopper commented 7 years ago

How do you present this particular view controller?

kishorehvk commented 7 years ago

UIStoryboard storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil]; UIViewController settingPage = [storyboard instantiateViewControllerWithIdentifier:@"ParticularViewController"]; [self presentViewController:settingPage animated:NO completion:nil]; by this way

kishorehvk commented 7 years ago

by using the above code I get back to main view controller where reveal menu is integrated. Then if i press menu button nothing is opening.

iDevelopper commented 7 years ago

If you present your controller like this, this is without SWRevealViewController, then revealViewController is nil. You have to push or set the front view controller with SWRevealViewController.

ex:

revealViewController().pushFrontViewController(settingPage, animated:true)

kishorehvk commented 7 years ago

Could U give me the full storyboard code so that It will be useful .. and thanks in advance

iDevelopper commented 7 years ago
    UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
    UIViewController *settingPage = [storyBoard instantiateViewControllerWithIdentifier:@"ParticularViewController"];
    UINavigationController *nc = [[UINavigationController alloc] initWithRootViewController:settingPage];
    [self.revealViewController pushFrontViewController:nc animated:YES];
kishorehvk commented 7 years ago

Thanks. But I tried the above code. It is not pushing back still in same View Controller itself

iDevelopper commented 7 years ago

If you could elaborate what you want to do exactly when you tap the menu button (open left menu?)

kishorehvk commented 7 years ago

If I click on menu button it should open Tableview that contains list of modules. But this is not opening showing revealViewController as nil

iDevelopper commented 7 years ago

From where the above code is executed?

kishorehvk commented 7 years ago

I created a three view controller vc1,vc2,vc3. vc1 is main view controller and vc 3 is the view controller that can be accessed through UIstoryboard. vc 2 is tableview controller where list of datas are present. So sw_rear will be vc2 and sw_front will be vc1. Now if i go to vc3 from vc 1 and come back to vc1, then the menu buton in vc1 which should go to vc three in not functioning

iDevelopper commented 7 years ago

In vc1: To vc 3

    UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
    UIViewController *settingPage = [storyBoard instantiateViewControllerWithIdentifier:@"ParticularViewController"];
    [self.navigationController pushViewController:settingPage animated:YES];
kishorehvk commented 7 years ago

Thanks