Xcode AMSlideMenu disable menu in some screens

575 views Asked by At

https://github.com/SocialObjects-Software/AMSlideMenu

in some screens need to disable slide menu and implement UInavigationbar button for other action

it's possible?

thanks

3

There are 3 answers

0
DarkSun On BEST ANSWER

To set menu button to your own, place the following code in a view controller:

    UIBarButtonItem *anotherButton = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"back_button"]
                                                                  style:UIBarButtonItemStylePlain
                                                                 target:self
                                                                 action:@selector(action:)];

    self.navigationController.navigationBar.topItem.leftBarButtonItem = anotherButton;

To ndisable pan gesture in view controller, then just import "UIViewController+AMSlideMenu.h" and call [self disableSlidePanGestureForLeftMenu];

0
debug On

AMSlideMenu provide some method to disable gesture :

- (void)addLeftMenuButton;
- (void)addRightMenuButton;
- (void)disableSlidePanGestureForLeftMenu;
- (void)disableSlidePanGestureForRightMenu;
- (void)enableSlidePanGestureForLeftMenu;
- (void)enableSlidePanGestureForRightMenu;

Just call disableslidegesture in your controller.

And change your navigationbar button target.

0
Marcel Hofgesang On

@DarkSun's answer seems correct for me. But in addition to it I wanted to mention that since iOS 8 you should call [self disableSlidePanGestureForLeftMenu]; in your ViewController's viewWillAppear function.

#import "UIViewController+AMSlideMenu.h"

-(void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    [self disableSlidePanGestureForLeftMenu];
}