mam zwyczaj klasy UIView GestureView. Mam przedłożoną deklarację dla tej klasy i jej delegata poniżej. Zaimportowałem plik GestureView.h do pliku .m. Działa to dobrze, ale system iOS wyświetla komunikat ostrzegawczy "Nie można znaleźć definicji protokołu dla GestureViewDelegate". Jeśli usuniemy zgłoszenie do przodu, otrzyma taki sam komunikat ostrzegawczy, co błąd. Nie chcę importować pliku GestureView.h z pliku ContainerViewController.h, ponieważ zazwyczaj importuję pliki w pliku .m. Czy ktoś mógłby wyjaśnić, co jest nie tak w podążaniu za strukturą klasy?iOS 5.0 Ostrzeżenie: Nie można odnaleźć definicję protokołu dla Delegata
ContainerViewController.h
#import <UIKit/UIKit.h>
@class DividerView;
@class GestureView;
@protocol GestureViewDelegate;
@interface ContainerViewController : UIViewController<GestureViewDelegate>
@property (strong, nonatomic) IBOutlet GestureView *topContentView;
@end
GestureView.h
#import <UIKit/UIKit.h>
@protocol GestureViewDelegate;
@interface GestureView : UIView
- (void)initialiseGestures:(id)delegate;
@end
@protocol GestureViewDelegate <NSObject>
@required
- (void)GestureView:(GestureView*)view handleSignleTap:(UITapGestureRecognizer*)recognizer;
@end
Gdzie jest zdefiniowany twój protokół? – Moxy
Możesz zobaczyć w opublikowanym przeze mnie kodzie! Jest w GestureView.h! – applefreak
W 'ContainerViewController.h' spróbuj' #import GestureView.h' zamiast deklaracji forward – Moxy