I am trying to display a loading indicator while I am waiting for a method in another class to return a value. The other class will use NSData to get data from a URL (for server login purposes).
I just want to know how I can stop my code in the main function to stop executing while i wait for the method in the other class to return a value. The main issue i am experiencing is that the indicator disappears because the code is continuing to run before I get a value.
My code is:
[self.view addSubview:loadingView];
loggedIn = [classB login:username password:password];
// More code
[loadingView removeFromSuperview];
I just want to know how i will be able to get around the indicator not being displayer. It will be displayed if i remove the following line:
[loadingView removeFromSuperview];