如果按照下面方式声明协议
@protocol VisitInfoCellDelegate
- (void)clickPhotoImage:(VisitInfoCell *)visitInfoCell;
@end
则
if ([self.delegate respondsToSelector:@selector(clickPhotoImage:)]) {
[self.delegate clickPhotoImage:self];
}
会报错,报错 No known instance method for selector 'respondsToSelector:'
解决方案:
遵守NSObject协议
@protocol VisitInfoCellDelegate <NSObject>
- (void)clickPhotoImage:(VisitInfoCell *)visitInfoCell;
@end