I have three UIViewController
that call a method in another Class, when there is need.
This fourth Class
subclass of NSObject, which I will call CheckController
, it makes a connection to a database on a server, and to do this takes a few seconds.
I have two questions to ask:
-FIRST: now to get the array back to me from the server, use a method that is almost embarrassing for me to share (bad code for me),
so i need to know how to call this CheckController
and return a value in the ViewController
from which the call originated.
-SECOND: how do I know in CheckController
, from which UIViewController, the method was invoked?
this is code of CheckController
:
-(void)connectionWithString:(NSString *)string {
//connection with server - work well
}
...
-(void)connectionDidFinishLoading:(NSURLConnection *)connection {
...
[self returnArray:myObject];
}
-(void)returnArray:(NSMutableArray *)arrayReturn {
//in this method i set the BOOL done to YES, but i believe that is it possible to
//send directly this arrayReturn to ViewController that invoked this method
done = YES;
NSLog(@"arrayReturn = %@", arrayReturn);
}
thanks in advance for the help, and tell me if something is not clear