我对 Objective-C 协议有疑问。
我已经定义了协议:
@protocol PlayerProfileSectionProReviewDelegate <NSObject>
- (void)didReceivedPlayerProfileSectionProReviewData;
@end
@interface PlayerProfileSectionProReviewModel : PlayerProfileSectionModel
@property (weak) id <PlayerProfileSectionProReviewDelegate> playerProfileSectionProReviewDelegate;
@end
在这个类实现中,我调用委托:
if ([self.playerProfileSectionProReviewDelegate respondsToSelector:@selector(didReceivedPlayerProfileSectionProReviewData)])
{
[self.playerProfileSectionProReviewDelegate didReceivedPlayerProfileSectionProReviewData];
}
在视图控制器中,我添加PlayerProfileSectionProReviewDelegate
并覆盖了didReceivedPlayerProfileSectionProReviewData
方法:
@interface PlayerProfileSectionProReviewViewController : PlayerProfileSectionViewController <UITableViewDelegate, UITableViewDataSource, PlayerProfileSectionProReviewDelegate>
@end
和
#pragma mark <PlayerProfileSectionProReviewDelegate>
- (void)didReceivedPlayerProfileSectionProReviewData
{
[self.playerProReviewTableView reloadData];
}
为什么我的协议不响应选择器?