0

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];
rmaddy
  • 314,917
  • 42
  • 532
  • 579
Ales
  • 13
  • 5

2 Answers2

1
    //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];
Lalit kumar
  • 1,797
  • 1
  • 8
  • 14
0

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.

JingJingTao
  • 1,760
  • 17
  • 28
  • My problem is when I choose in my menu and open it. It open without TabBar bottom. – Ales Jul 17 '16 at 09:16
  • You menu viewcontroller needs to have a tab bar? If so then just assign tab bar to the rightViewController. Do you need every option in the menu to load a tab bar? – JingJingTao Jul 17 '16 at 09:29
  • Menu does not need tab bar. Others options (viewcontroller or tableviewcontroller) in the menu must load a tab bar bottom. – Ales Jul 17 '16 at 09:42
  • I solved a problem by changing the tableviewcontroller to viewcontroller and manually adding the tab bar controller, but I have lot controllers in my project. – Ales Jul 17 '16 at 09:46
  • Yeah you will need to add tab bars to all your option viewcontrollers if they are different, if you only need a tableview you can use tableviewcontroller, otherwise if you need anything additional, like a tab bar or progress indicator you should use a viewcontroller and add a tableview. – JingJingTao Jul 17 '16 at 09:59
  • Can you please show me how you add that programmatically? I am facing the same issue and not able to solved. – nadim Aug 25 '23 at 13:23