cannot understand the following code in objective c?
开发者_开发技巧the following is declared inside the @interface
of another class... I don't understand the syntax and what it is trying to say
@interface someclass:NSObject
....
@end
@interface NSObject (HSRequestClassDelegate)
-(void) finishedWithData:(HSRequest *) request data:(NSMutableData *) data;
-(void) failedWithError:(HSRequest *) request error:(NSError *) error;
-(void) noConnection:(HSRequest *) request;
@end
The name of the above file is someclass.h?
what does the line @interface NSObject (HSRequestClassDelegate)
mean?
thank you in advance.
This is a definition of an informal protocol. Prior to protocols being introduced, protocols were defined as a category on NSObject
.
That's called a "category" in cocoa.
精彩评论