使用LLVM Compiler 2.0时,我似乎遇到了一个新错误,这是我之前没有的.
我有一个名为DTGridViewDelegate的协议,定义如下:
@protocol DTGridViewDelegate <UIScrollViewDelegate>
我有一个名为delegateDTGridView的属性(UIScrollView的子类,它本身有一个delegate属性).这被定义为:
@property (nonatomic, assign) IBOutlet id<DTGridViewDelegate> delegate;
现在我收到的消息是:
DTGridView.h:116:63: error: property type 'id<DTGridViewDelegate>' is incompatible with type 'id<UIScrollViewDelegate>' inherited from 'UIScrollView'
因为我曾说过DTGridViewDelegate符合UIScrollViewDelegate,我认为以这种方式覆盖这个属性是可以的,事实上这是第一个提出存在问题的编译器.
我通过声明属性来修复错误:
@property (nonatomic, assign) IBOutlet id<DTGridViewDelegate, UIScrollViewDelegate> delegate;
我想知道这是否是编译器问题?