Ales
Ales

Reputation: 13

SWRevealViewController with TabBarController

I use SWRevealViewController in my project. My app have TabBarController. I did that I open the menu. When I select in menu it open without TabBarController bottom. I use Storyboard. My start View is ViewController with class SWRevealViewController. I connect to my menu with identifier sw_rear and class SWRevealViewControllerSegueSetController. Before menu I have Navigation Controller. I also connect SWRevealViewController to my TabBar with identifier sw_front and class SWRevealViewControllerSegueSequeController. What am I doing wrong?

In my menu to open a View I have this code:

 BookTableViewController *m = [self.storyboard instantiateViewControllerWithIdentifier:@"Book"];
        [self.revealViewController pushFrontViewController:[[UINavigationController alloc] initWithRootViewController:m] animated:YES];
        [self.revealViewController setFrontViewPosition:FrontViewPositionLeft animated:YES];

Upvotes: 0

Views: 786

Answers (2)

Lalit kumar
Lalit kumar

Reputation: 2207

    //Tabbar controller name on storyboard
     Tabbarcontroller *tabvc=(Tabbarcontroller *)[self.storyboard  instantiateViewControllerWithIdentifier:@"TabbarcontrollerVCId"];
     NSLog(@"tabvc controller ===>%@",tabvc.viewControllers);

     Select viewcontollers and pass index
     tabvc.selectedIndex=0;

    [self.revealViewController setFrontViewController:tabvc];
    [self.revealViewController setFrontViewPosition: FrontViewPositionLeft animated: YES];

Upvotes: 1

JingJingTao
JingJingTao

Reputation: 1790

From what I understand, you want the front viewcontroller to be a tab bar and a menu with no tab bar?

So there are three things, front, rear and right. If you have not already look at the AppDelegate in RevealControllerExample and try do the following,

  1. Create an instance of your tabbar
  2. Create SWRevealViewController, init with nil as the rear and your tabbar as the front (if you can't use nil as the rear, just create a UIViewController, but you won't use it).
  3. Create you menu viewcontroller and assign it to the rightViewController property of the SWRevealViewController

If this does not solve your problem please comment, good luck.

Upvotes: 0

Related Questions