Hi,
I am working on a class A which has a method -(void)DoSmthing1. I am making a call to another method-(void)DoSmthing2 in class B. Now after doing some operations in class B, the method is supposed to call back a method-(void)DoSmthing3 previous class.
How will i call a method of current class from another class?? Can someone please help me....
Thanks in advance
edit1:: My Code: Class A
{
-(void) MethodA {
}
-(void) MethodB {
ClassB *clsB = [[ClassB alloc] init];
[clsB MethodC];
}
}
Class B
{
-(void)MethodC:(selector) {
//here i want to call MethodA of classA, and i will prefer if it is possible by sending the name of the method as selector in this method(methodC)
}
}
edit2::
Another example i want to do smthing like follwoing:
ClassB *b = [[ClassB alloc] nitWithTarget:self selector:@selector(methodfromClassA) object:nil];
Here i want to call a method of class A once some task in Class B is completed, and that too from class A.
I hope it is much clear now.
Edit3:
- (void)loadView {
AsyncConnection *async =[[AsyncConnection alloc] init];
[async getAsync:self callback:@selector(test1)];
}
above code is from first class
-(void)getAsync:(id)anObject callback:(SEL)selector {
NSInvocationOperation *operation = [[NSInvocationOperation alloc] initWithTarget:anObject
selector:@selector(selector)
object:nil];
[queue addOperation:operation];
[operation release];
}
and above code is from second class. Here i want to call a method of first class which is passed as selector.