@protocol BGTableViewDelegateMother <BGIhaveNavigationController>
@end
@interface BGTableViewDelegateMother : NSObject
@property (weak,nonatomic) UITableView * tv;
@property id <BGIhaveNavigationController> delegate;
@end
说后者我想继承BGTableViewDelegateMother。
但是,我想将委托的类型更改为其他内容。也许不是。有可能吗?
当然BGIhaveNavigationControllerandsomeotherthing继承自BGIhaveNavigationController
答案 0 :(得分:1)
只要您的子类委托符合的协议包含BGIhaveNavigationController协议,它就没问题。你可以这样做:
@protocol BGIhaveNavigationControllerAndSomethingElse <BGIhaveNavigationController>
- (void)somethingElse;
@end
@interface BGTableViewDelegateChild : BGTableViewDelegateMother
@property id <BGIhaveNavigationControllerAndSomethingElse> delegate;
@end
请注意,如果BGIhaveNavigationControllerAndSomethingElse被声明为
@protocol BGIhaveNavigationControllerAndSomethingElse <NSObject>
(即不包含BGIhaveNavigationController)然后编译器会抱怨BGIhaveNavigationController
的委托类型。