Search code examples
objective-cios7delegatesxcode5protocols

IOS AMSlideMenu open menu callback


I'm new in IOS, and can't understand some things about delegates and protocols. In my project I'm using AMSlideMenu for slide menu. I need to update same data in slide menu. For that I need to catch openMenu callback. In instruction for slide menu I found this

 If you want to get menu's open/close callbacks, then set MainVC's delegate property, and implement protocol named 'AMSlideMenuProtocols'. 

 @optional
 - (void)leftMenuWillOpen;
 - (void)leftMenuDidOpen;
 - (void)rightMenuWillOpen;
 - (void)rightMenuDidOpen;

I tried to catch callback with this code

//myClass.h    
#import "AMSlideMenuLeftTableViewController.h"
#import "AMSlideMenuMainViewController.h"
@interface myClass : AMSlideMenuLeftTableViewController<AMSlideMenuDelegate>

@end

//myClass.m
#import "myClass.h"

@interface myClass ()

@end

@implementation myClass
-(void)leftMenuWillOpen
{
    //something
}
@end

but leftMenuWillOpen never gets invoked. What I did wrong?


Solution

  • I guess you are not setting the delegate to the slide menu. The object of myClass should be the delegate to AMSlideMenu object.