A solution could be implementing the protocol at the Category declaration.
For example, I wanna implement the NSXMLParserDelegate in a class but just want the selectors to be
called as delegate.
at .h declaration:
@interface ClassName : NSObject { //sth..... } @end
at .m file (or other .h file in some cases) declaring the extension:
@interface ClassName(NSXMLParserDelegate) <NSXMLParserDelegate> //some function in the NSXMLParserDelegate protocol..... @end @implementation ClassName(NSXMLParserDelegate) //do sth... @end @implementation ClassName //....... @end
Reference: Stackoverflow
沒有留言:
發佈留言