Search code examples
iosobjective-cxcode5amslidemenu

Xcode AMSlideMenu Opening Left menu only with a button, disabling swipe


This might sound like a weird request but I've been using the AMSlideMenu (which is fantastic) https://github.com/SocialObjects-Software/AMSlideMenu

But on one of my specific projects I need to be able to open the left side menu only using a button.

Now I have a button that's currently working to open and close the menu, but for this specific project I need to use swipe gestures, so I would need to disable accessing the menu via swipes.

I've been looking at the methods that are within the AMSlideMenu files, but I can't figure out how to disable the swiping.

Any help would be greatly appreciated!


Solution

  • If you've read the documentation in the link, you could notice they stated that you have to import "UIViewController+AMSlideMenu.h" on your pushed view controller and then call [self disableSlidePanGestureForLeftMenu]; on your viewDidLoad method (or wherever you want). I've tried it with the example they've provided and it works.

    enter image description here

    Update:
    For iOS 8+ you should call this method on viewWillAppear and not viewDidLoad as mentioned here.