2012-02-27 2 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

Что такое круглый импорт? –

+0

В ViewController.h вы '# import' TKCalendarMonthView.h, а в TKCalendarMonthView.h вы' # import' ViewController.h - round –

+0

THANK U N +1 FOR U ... –

Смежные вопросы