I'm using MMDrawerController in my project and I don't want it to be the rootViewController. Also I'm using storyboard to set the UI. Most sample code doesn't present like this. So I'm a little confuse how to do it.
I've set a FirstViewController embed with navigationController and there is a Button
on it. ButtonClick push the controller to CenterViewController.
Here is my code...
FirstViewController.m
UIViewController * centerViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"CenterViewController"];
UIViewController * rightSideDrawerViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"RightViewController"];
self.drawerController = [[MMDrawerController alloc] initWithCenterViewController:centerViewController rightDrawerViewController:rightSideDrawerViewController];
[self.drawerController setShowsShadow:NO];
[self.drawerController setMaximumRightDrawerWidth:150.0];
[self.drawerController setOpenDrawerGestureModeMask:MMOpenDrawerGestureModeAll];
[self.drawerController setCloseDrawerGestureModeMask:MMCloseDrawerGestureModeAll];
CenterViewController.m
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = [UIColor lightGrayColor];
MMDrawerBarButtonItem * rightDrawerButton = [[MMDrawerBarButtonItem alloc] initWithTarget:self action:@selector(rightDrawerButtonPress:)];
[self.navigationItem setRightBarButtonItem:rightDrawerButton animated:YES];
}
-(void)rightDrawerButtonPress:(id)sender{
[self.mm_drawerController toggleDrawerSide:MMDrawerSideRight animated:YES completion:nil];
}
RightViewController.m
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = [UIColor yellowColor];
}
It can't work. I'm confuse whether should I put a MMDrawerController in storyboard?