0

I'm using MMdrawerController to practice side drawer controllers in my project. But when I tap on the menu button on the left side, then tap to the row that selected, it opens just fine, but the corresponding view doesn't show menu item (drawer menu button) on the left of the view. So I can't make any further selection. And I use storyboard.

Sample code from MydrawerController I navigate through cells in drawer's tableview.

#pragma mark - Table view delegate

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [self.delegate drawerMenuViewController:self didSelectMenuSection:indexPath.row];
       switch ((MMDrawerMenuViewControllerSection)indexPath.row) {
        case MMDrawerMenuViewControllerSectionProfile:

            [self.mm_drawerController setCenterViewController:[self.storyboard instantiateViewControllerWithIdentifier:@"MMProfileViewController"] withCloseAnimation:YES completion:nil];


            break;

        default:
            break;
    }


}

My center view is simply does these:

-(void)setupLeftMenuButton{
    MMDrawerBarButtonItem *leftDrawerButton=[[MMDrawerBarButtonItem alloc]initWithTarget:self action:@selector(leftDrawerButtonPress:)];
    [self.navigationItem setLeftBarButtonItem:leftDrawerButton animated:YES];


}


- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

-(void)leftDrawerButtonPress:(id)sender{
    [self.mm_drawerController toggleDrawerSide:MMDrawerSideLeft animated:YES completion:nil];
}

-(void)doubleTap:(UITapGestureRecognizer*)gesture{
    [self.mm_drawerController bouncePreviewForDrawerSide:MMDrawerSideLeft completion:nil];
}

And my other view controller that can't display menu item has the same button handlers given above. But still not showing the menu item.

Neeku
  • 3,646
  • 8
  • 33
  • 43

1 Answers1

-1

It's not possible to push the controller into centerView from the side view, I have done this but need to use the delegate, I have define a protocol into left side controller like

@protocol LGSettingDrawerControllerDelegate <NSObject>

- (void)pushControllerWithIndex:(NSIndexPath*)indexPath;

@end

@property (nonatomic, weak) id<LGSettingDrawerControllerDelegate> delegate;

and in

in

.m file

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    if (_delegate != nil) {
        [_delegate pushControllerWithIndex:indexPath];
    }
    [self.menuContainerViewController setMenuState:MFSideMenuStateClosed];
}

and this delegate method do push at center view controller like

[self.mm_drawerController setCenterViewController:[self.storyboard instantiateViewControllerWithIdentifier:@"MMProfileViewController"] withCloseAnimation:YES completion:nil];
Retro
  • 3,985
  • 2
  • 17
  • 41
  • Actually my problem here is , MenuItem doesn't displayed on the selected view.Instead drawer side menu works fine by sliding view from left to right. I have trouble why it's not show leftbarbutton – user3079947 Jul 10 '14 at 18:20
  • can you add a image to understand your problem better? – Retro Jul 10 '14 at 18:41