RESideMenu
RESideMenu copied to clipboard
presentLeftMenuViewController:]: unrecognized selector sent to instance
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:
I tried to follow the examples but nothing is working. Thanks
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?
Not really, I was experiencing an "unrecognized selector" kind of error, which I'm not experiencing when I use this controller without cocoapod.
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]; }