I have a subclass of UIImageView and would like to pass self as a parameter to the delegate. I get a error “Expected ‘)’ before MyImageView”. I need to pass the object to the delegate so the delegate can read certain properties from the object.
#import <UIKit/UIKit.h>
@protocol MyImageViewDelegate <NSObject>
-(void) buttonPressedForView:(MyImageView *) imageView; //line with ERROR...
@end
@interface MyImageView : UIImageView {
id <MyImageViewDelegate> delegate;
BOOL _imageMode;
}
@property (nonatomic,assign) id <MyImageViewDelegate> delegate;
@property (nonatomic,readonly) BOOL imageMode;
I think you need a forward declaration of MyImageView before your protocol declaration.