Show Tabbar from REFrostedViewController sidemenu objective-c

隐身守侯 提交于 2020-03-04 23:06:53

问题


I'm using REFrostedViewController(https://github.com/romaonthego/REFrostedViewController) to show side menu in my app. Side menu works properly, but the problem is I have tabbar controller in content screen. Side menu has tableview with options to navigate. On tap of any options in side menu, am redirecting to viewcontrollers in another storyboards. I want the tabbar to be visible after selecting any option from Sidemenu.

This is how I'm assigning contentViewController and menuViewController in REFrostedViewController derived class.

- (void)awakeFromNib {
self.contentViewController = [storyBoard instantiateViewControllerWithIdentifier:@"tabbarViewController"];
self.menuViewController = [storyBoard instantiateViewControllerWithIdentifier:@"menuViewController"];
}

In simple, I need the tabbar to be visible in all the screens. But when navigating from side menu, tabbar is not shown.

Below is the code in Sidemenu controller

 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    self.frostedViewController.contentViewController = anotherControllerNavVC;
 }

I can understand its because sidemenu class doesn't have instance of tabbar and the above line is replacing the content view controller. Anyone know how to achieve this with REFrostedViewController.

I tried creating global instance of Tabbar controller. Below is my code

     + (instancetype)sharedInstance {
          static TabController *tabbarVC = nil;
          static dispatch_once_t onceToken;
          dispatch_once(&onceToken, ^{
              tabbarVC = [[super alloc] init];
          });
       return tabbarVC;
      }

And in side menu

    TabController *tabClassObj = [TabController sharedInstance];
    [tabClassObj.selectedViewController pushViewController:newVC animated:YES];

来源:https://stackoverflow.com/questions/60278538/show-tabbar-from-refrostedviewcontroller-sidemenu-objective-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!