this is my protocol.
@protocol UCMapviewDelegate <NSObject>
@required
- (void)slideMapviewIn:(id)sender;
- (void)slideMapviewOut:(id)sender;
@end
This is were the methods should get called (In UCMapViewController.m). showMenu gets called from a button
- (void)showMenu
{
// TODO:
if (self.isMapViewPushedAside) {
[self.delegate slideMapviewOut:self];
} [self.delegate slideMapviewIn:self];
}
And this is were the delegate is initialized. initializer for a UCMapViewController object.
- (id)initWithDelegate:(UCRootViewController *)controller
{
self = [super init];
if (self) {
// Custom initialization
self.delegate = controller;
}
return self;
}
but when I want to use the delegate to call it, I get the error: No known instance method for selector 'slideMapviewIn:'. what can I do about this?
Your problem is that you are not declaring your delegate as implementing that protocol. If you don’t do that, how is it supposed to know that it implements that protocol? That error is natural.
You must declare it as
id<UCMapviewDelegate>and to do that you must import the header that contains that protocol.