I cannot seem to build my protocol the way I would like and I have narrowed down to a problem with using derived classes. If I use a cocoa class it seems to work. Here is what I have…
#import <Foundation/Foundation.h>
#import "MyView.h"
@protocol MyDelegate
- (void)view:(MyView *)aView didDoSomethingWithString:(NSString *)string;
@end
The MyView class is…
#import <UIKit/UIKit.h>
@interface MyView : UIView {
NSString *whatever;
}
- (void)myMethod;
@end
@implementation MyView
- (void)myMethod {
doSomething...
}
@end
So when I attempt to build I get the error “Expected ‘)’ before ‘MyView'”. If I replace the custom class MyView with UIView then the code compiles. I am hoping someone sees something that I am overlooking. Any ideas are appreciated.
Thanks.
Are you sure MyView.h contains
@interface MyView : UIView?Also, instead of importing you can use @class. e.g.