2012-02-27 29 views
0

カスタムプロトコルを使用しているときにエラーが発生します。エラー:iphone sdkでプロトコルの宣言が見つかりません

TKCalendarMonthView.h

#import "ViewController.h" 

@protocol EventViewProtocol; 

@interface TKCalendarMonthView : UIView <PSMonthSelectedDelegate, PSYearSelectedDelegate,UIGestureRecognizerDelegate> { 

    id <EventViewProtocol> __unsafe_unretained eventDelegate; 

} 

@property (nonatomic,unsafe_unretained) id <EventViewProtocol> eventDelegate; 

@end 

@protocol EventViewProtocol <NSObject> 

- (void)navigateToEventView; 

@end 

ViewController.h

#import <UIKit/UIKit.h> 
#import "ELScrollView.h" 
#import "TKCalendarMonthView.h" 

@interface ViewController : UIViewController <UIGestureRecognizerDelegate, EventViewProtocol> //At this line I am getting the error as "Cannot find protocol declaration for EventViewProtocol" 

@property (nonatomic, strong) UIColor* horizontalBgColor; 
@property (nonatomic, strong) UIColor* verticalBgColor; 


@end 

答えて

1

あなたは、円形のインポート参照を持っています。 TKCalendarMonthViewを次のように変更してください:

@class ViewController; 
@protocol EventViewProtocol; 

@interface TKCalendarMonthView : UIView <PSMonthSelectedDelegate, PSYearSelectedDelegate,UIGestureRecognizerDelegate> { 

    id <EventViewProtocol> __unsafe_unretained eventDelegate; 

} 

@property (nonatomic,unsafe_unretained) id <EventViewProtocol> eventDelegate; 

@end 

@protocol EventViewProtocol <NSObject> 

- (void)navigateToEventView; 

@end 
+0

循環参照の意味は何ですか? ViewController.hで –

+0

あなた '#のimport'のTKCalendarMonthView.h、およびTKCalendarMonthView.hであなた'#import' ViewController.h - 円形 –

+0

はU FOR U N +1をありがとう... –

関連する問題