当我尝试在以下两个类中使用协议时,编译器说无法找到协议声明
的ViewController:
#import <UIKit/UIKit.h>
#import "SecondViewController.h"
@protocol FlipOtherSideViewControllerDelegate;
@interface ViewController : UIViewController<FlipsideViewControllerDelegate> {
id <FlipOtherSideViewControllerDelegate> __unsafe_unretained delegate;
}
- (IBAction)switchMode:(id)sender;
@property (unsafe_unretained) id <FlipOtherSideViewControllerDelegate> delegate;
@end
@protocol FlipOtherSideViewControllerDelegate
- (void)flipothersideViewControllerDidFinish:(ViewController *)controller;
@end
SecondViewController:
#import <UIKit/UIKit.h>
#import "ViewController.h"
@protocol FlipsideViewControllerDelegate;
@interface SecondViewController : UIViewController <FlipOtherSideViewControllerDelegate> {
id <FlipsideViewControllerDelegate> __unsafe_unretained delegate;
}
@property (unsafe_unretained) id <FlipsideViewControllerDelegate> delegate;
@end
@protocol FlipsideViewControllerDelegate
- (void)flipsideViewControllerDidFinish:(SecondViewController *)controller;
@end
上述任何建议? 提前致谢。
答案 0 :(得分:0)
为什么在界面下方声明?尝试在接口声明之前声明。我认为那时不应该有任何错误。