Delegate in Objective C is used when one class objects wants to assign some of its work to another object.
Example:- in NSTableView we want cell to be drawn as per requirement. So we can delegate that adding data to cell will be done by that another delegate class object.
use of category with delegate
Example:- in NSTableView we want cell to be drawn as per requirement. So we can delegate that adding data to cell will be done by that another delegate class object.
use of category with delegate
@interface NSObject (NSCommonDelegateMethods)
- (void) commonMethodForallclass: (NSObject *) browser;
@end
By putting a category on NSObject , any kind of object can be used as a delegate object. There
is no need to inherit from a specialized class.
Adding category on NSObject is called creating an informal protocol.
0 comments:
Post a Comment