AMSlideMenu2 icon indicating copy to clipboard operation
AMSlideMenu2 copied to clipboard

Left Menu is showing in all views of the storyboard

Open caraldel opened this issue 10 years ago • 14 comments

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 !

caraldel avatar Nov 26 '15 16:11 caraldel

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];
}

arturdev avatar Nov 26 '15 21:11 arturdev

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.

caraldel avatar Nov 27 '15 09:11 caraldel

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

arturdev avatar Nov 27 '15 11:11 arturdev

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 avatar Nov 30 '15 10:11 caraldel

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

caraldel avatar Nov 30 '15 11:11 caraldel

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

arturdev avatar Nov 30 '15 23:11 arturdev

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

caraldel avatar Dec 01 '15 16:12 caraldel

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

hardikamal avatar Dec 02 '15 07:12 hardikamal

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];

caraldel avatar Dec 02 '15 08:12 caraldel

Hi @caraldel any solution found??

hardikamal avatar Dec 18 '15 14:12 hardikamal

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

arturdev avatar Dec 18 '15 20:12 arturdev

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

hardikamal avatar Dec 21 '15 10:12 hardikamal

@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?

hardikamal avatar Apr 16 '16 08:04 hardikamal

For Swift:

Disable the content pan gesture in the viewWillAppear

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

Bloueco avatar Sep 26 '20 14:09 Bloueco