I want to add an argument to a delegate methode (From NSXMLParserDelegate)
this is the method so far :
- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string{
// save the characters for the current item...
if ([string isEqual: @"off"]) {
myObject.isON = NO; //doesn't know what is myObject
}
What I want :
- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string:(MyObject*)anObject{
// save the characters for the current item...
if ([string isEqual: @"off"]) {
anObject.isON = NO;
}
Thank you
First you need to subclass your
NSXMLParser
, add newdelegate
property call itsubclassDelegate
or something similar, so you can differentiate between the super class's delegate. In init be the delegate of your superclassself.delegate = self
;respond to the delegate methods and forward the methods that you don't want to override to the
self.subclassDelegate
respond to the method that you want to override and override it in your subclass protocol.Here is the example:
Then in .m