matghazaryan / AMSlideMenu2

Sliding Menu for iOS (Left and Right menus). Multiple storyboards and XIBs support.
MIT License
1.2k stars 194 forks source link

Left Menu is showing in all views of the storyboard #171

Open caraldel opened 8 years ago

caraldel commented 8 years ago

Hello,

I have a question that I can't solve. I'm using your framework, but I want to show the Left menu only in the main view and not in other views. What is the way to configure the AMSlideMenu ?

Thanks a lot !

arturdev commented 8 years ago

Try to remove leftBarButtonItem from navigationItem in -viewWillAppear: method in a viewController that you don't wont to show the menu. And also call -disableSlidePanGestureForLeftMenu method. e.g.

#import "UIViewController+AMSlideMenu.h"
//...
- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated]
    self.navigationItem.leftBarButtonItem = nil;
    [self.mainSlideMenu disableSlidePanGestureForLeftMenu];
}
caraldel commented 8 years ago

Thanks for your reply, but it doesn't work in the way i would like because I don't want to disable the leftBarButtonItem in which I have my back button. Is it any other way ??

Thanks in advance.

arturdev commented 8 years ago

Ah, than just remove that line self.navigationItem.leftBarButtonItem = nil;

caraldel commented 8 years ago

Removing the line it's working well and I can show the button again, but the left menu slides already. This line [self.mainSlideMenu disableSlidePanGestureForLeftMenu]; is not working ...

caraldel commented 8 years ago

Can I configure my main view with adding the slide only in this view ?

arturdev commented 8 years ago

Hmm, its very strange. Arte you sure that you wrote that in '-viewWillAppear:' method

caraldel commented 8 years ago

Yes, I copy the method you posted and I added the log to show the [self.mainSlideMenu] and is not null, it returns me MainVC, where I tell to the application this: @interface MainVC : AMSlideMenuMainViewController

hardikamal commented 8 years ago

this solution works...but if any uipopovercontroller or uialertview shown and then dismissed...the left menu starts sliding again...any solution to this???

caraldel commented 8 years ago

Yea, you are right, in my case I push the view with an alert 'Loading' until it finish to load the data for my next view and in this view is when is not working the line [self.mainSlideMenu disableSlidePanGestureForLeftMenu];

hardikamal commented 8 years ago

Hi @caraldel any solution found??

arturdev commented 8 years ago

For now try to call [self.mainSlideMenu disableSlidePanGestureForLeftMenu]; again when popover/alertview is dismissed, until I'll fix this.

hardikamal commented 8 years ago

@arturdev even though i call this method its not working on dismissing the popover... :(

hardikamal commented 8 years ago

@arturdev I wanted to add one more point where in this issue comes up when keyboard appears. Now imagine I have a form in my UIViewController and there are 15+ elements for which keyboard will come up. Above fix is not working... Could you guide how to fix this?

Bloueco commented 4 years ago

For Swift:

Disable the content pan gesture in the viewWillAppear

override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(true) slideMenuMainVC?.contentPanGestureRecognizer.isEnabled = false }