mutualmobile / MMDrawerController

A lightweight, easy to use, Side Drawer Navigation Controller
MIT License
6.76k stars 1.38k forks source link

MMDrawerController in UITabbarController #312

Closed scaryterry closed 9 years ago

scaryterry commented 9 years ago

Hi there, I just want to ask if there is a easy way of using a tab of the UITabBarController as the centre of the MMDrawerController? I did manage to accomplish this but only using a blank uiviewcontroller as the first screen of a tabbar item, whose only action is to call prepareforsegue in its viewdidload in order to set the view I want to show as the centre of the side drawer by tapping on a UITabbar item. Although this hacky way works it has the unintended effect of briefly displaying the blank uiview before loading the required view with the side drawer

kcharwood commented 9 years ago

Hey @scaryterry

Ya that's a bit of an odd one. I definitely only given thought to how this paradigm should work when the center is a UINavigationController (also described in the README). I would call this unsupported for now, and haven't really seen other need for expanding that support to include tab controllers. Feel free to open a pull request with that feature and we'll review it.

genaks commented 9 years ago

For the record, I was able to use a TabBarController as the center view. Only problem I am having is the disappearing of bar buttons from the Navigation Controllers that Tab Bar houses. Haven't really found the cause yet, will update when I do. Any help is appreciated though

braniac007 commented 8 years ago

@genaks Please share some code how did you make it work, i am stuck in the same problem.

scaryterry commented 8 years ago

No problem, basically I put an empty controller on the storyboard tab controller whose job is to load the controller I want to display that has mmdrawer enabled.

Note though my "solution" is by no means perfect since the empty controller can be briefly seen before the controller with the drawer appears. If you can solve this please let me know, I would really appreciate it! I wasted a ton of time trying to workaround that to no avail though!

On the first "blank" controller I put this as its class:

import "MapFilterLoadViewController.h" #import "UIViewController+MMDrawerController.h" #import "MMDrawerVisualState.h" #import "MapFilteringOptionsTableViewController.h" #import "MapDisplayViewController.h" #import "GeneralMethods.h" @interface MapFilterLoadViewController ()@end @implementation MapFilterLoadViewController UIAlertView loadingAlert; UIActivityIndicatorView loading;

pragma mark - Navigation - (void)prepareForSegue:(UIStoryboardSegue )segue sender:(id)sender { if ([segue.identifier isEqualToString:@"openMapFilterController"]) { //[GeneralMethods handleConsoleOutputMessage:nil outputMessage:@"loading side drawer controller for map"];MMDrawerController destinationViewController = (MMDrawerController ) segue.destinationViewController; // // Instantitate and set the center view controller.MapDisplayViewController centerViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"MAP_NEARBY"]; // MapDisplayViewController centerViewController = [[MapDisplayViewController alloc] init]; [destinationViewController setCenterViewController:centerViewController]; // Instantiate and set the left drawer controller.MapFilteringOptionsTableViewController \ rightDrawer = [self.storyboard instantiateViewControllerWithIdentifier:@"FILTER_MAP"];[destinationViewController setRightDrawerViewController:rightDrawer]; } }

@end

You just need to change the controller identifiers to the ones you have in your storyboard.

Apologise for formatting but this was done on my phone, I hope this will help.

scaryterry

On 7 Mar 2016, at 11:51, braniac007 notifications@github.com wrote:

@genaks Please share some code how did you make it work, i am stuck in the same problem.

— Reply to this email directly or view it on GitHub.