Am new to development.I got an error regarding the "Expected a Type" error.In two classes of my application,i declared the method in one class and in another class i used that method with the help of @protocol method.How to resolve it.Two classes DayButton.h and DDCalenderView.h
In DayButton.h
, i declared as
@protocol DayButtonDelegate <NSObject>
-(void)dayButtonPressed:(id)sender;
@end
And in DDCalenderView.h
,i wrote as
@protocol DDCalenderViewDelegate<NSObject>
-(void)dayButtonPressed:(DayButton *)button;
Getting an exception near void method in DDCalenderView.h
SOLUTION: Move the import from the implementation to the header file. I think that there were some imports in the implementation file that were not in the header file.Make sure that you have the correct import. It’s one of those little bugs/mistakes that make you shake your head… at yourself.
In DDCalenderView.h you should type @class DayButton;
above @protocol DDCalenderViewDelegate<NSObject>
. This will tell the compiler that DayButton is a class (that is declared somewhere else).
You can also add #import "DayButton.h"
to the top of DDCalenderView.h.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With