I am writing just a piece of code, but taking an error that "expected type @line - (void)backButtonTapped:(TopBarViewController *) topBarViewController;
What is wrong with this?
@protocol TopBarDelegate
- (void)backButtonTapped:(TopBarViewController *) topBarViewController;
@end
@interface TopBarViewController : UIViewController
{
}
@property (assign, nonatomic) id <TopBarDelegate> delegate;
-(void) backButtonPressed:(id)sender;
-(void) menuButtonPressed:(id)sender;
@end
Add the following at the top. Since the protocol TopBarDelegate
is defined above the class TopBarViewController
, at the point you define the protocol, the compiler doesn't know there is a class called TopBarViewController
. This line tells it there really is a class with that name defined somewhere.
@class TopBarViewController;
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