RESideMenu icon indicating copy to clipboard operation
RESideMenu copied to clipboard

presentLeftMenuViewController:]: unrecognized selector sent to instance

Open massdonati opened this issue 10 years ago • 3 comments

Hello, I'm trying to use this controller but on a Bar button item I can't figure out how to show the menu without having my app to crash. The "Menu" button is set up as follow: screen shot 2014-07-14 at 2 11 05 am

screen shot 2014-07-14 at 2 11 14 am

I tried to follow the examples but nothing is working. Thanks

massdonati avatar Jul 14 '14 09:07 massdonati

hello @maxydon - I'm having issues with this too (using storyboard and following the Storyboard example on the README). When I hit the Bar Button, the "firstViewController" zooms out but there's no leftMenuViewController table even though I've programmatically created a table -- is that what you're experiencing too?

rrrrrraul avatar Jul 27 '14 03:07 rrrrrraul

Not really, I was experiencing an "unrecognized selector" kind of error, which I'm not experiencing when I use this controller without cocoapod.

massdonati avatar Jul 27 '14 07:07 massdonati

I just started using cocoapods myself and had the same problem. Here's what I ended up doing. In any vc with a menu button:

  • (void) presentLeftMenuVC { AppDelegate* appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate]; id sideMenu = appDelegate.sideMenu; [sideMenu presentLeftMenuViewController]; }

  • (void) configureButtons { __weak typeof(&*self) weakself = self;

    // this button takes us back to the main menu UIButton* menuButton = [Util menuBtn]; // creates the UIButton with an image [menuButton addTarget:self action:@selector(presentLeftMenuVC) forControlEvents:UIControlEventTouchUpInside]; UIBarButtonItem* menuBtnItem = [[UIBarButtonItem alloc] initWithCustomView:menuButton];

    weakself.navigationItem.leftBarButtonItem = menuBtnItem; }

where sideMenu is a property in AppDelegate.h:

@property (nonatomic, strong) RESideMenu* sideMenu;

and here's where we set it:

  • (void) initWithNavigationController: (UIViewController*) nc { // side menu id mvc = [MenuViewController new]; self.sideMenu = [[RESideMenu alloc] initWithContentViewController: nc leftMenuViewController: mvc rightMenuViewController: nil];

    self.sideMenu.backgroundImage = [UIImage imageNamed:@"IMG_0842_1024"]; self.sideMenu.menuPreferredStatusBarStyle = UIStatusBarStyleLightContent; self.sideMenu.delegate = self;

    self.sideMenu.contentViewShadowColor = [UIColor blackColor]; self.sideMenu.contentViewShadowOffset = CGSizeMake(0, 0); self.sideMenu.contentViewShadowOpacity = 0.6; self.sideMenu.contentViewShadowRadius = 12; self.sideMenu.contentViewShadowEnabled = YES;

    self.window.rootViewController = self.sideMenu;

    self.window.backgroundColor = [UIColor whiteColor]; [self.window makeKeyAndVisible]; }

comiclandapp avatar Mar 21 '16 01:03 comiclandapp