我正在查看Apple的示例代码lazy table image loading。我看到他们有两条以@protocol ParseOperationDelegate
开头的行。他们为什么要这样做两次?我所看过的Objective C协议的所有文档都不会告诉你两次。为什么在Apple的示例代码中定义了两次协议?
@class AppRecord;
@protocol ParseOperationDelegate;
//@interface ParseOperation : NSOperation <NSXMLParserDelegate>
@interface ParseOperation : NSOperation
{
@private
id <ParseOperationDelegate> delegate;
NSData *dataToParse;
NSMutableArray *workingArray;
//AppRecord *workingEntry;
//NSMutableString *workingPropertyString;
//NSArray *elementsToParse;
//BOOL storingCharacterData;
}
- (id)initWithData:(NSData *)data delegate:(id <ParseOperationDelegate>)theDelegate;
@end
@protocol ParseOperationDelegate
- (void)didFinishParsing:(NSArray *)appList;
- (void)parseErrorOccurred:(NSError *)error;
@end