Mahmoud Fayez
Mahmoud Fayez

Reputation: 3459

UIActivityIndicator

When I start UIActivityIndicatorView using StartAnimating method: [ActivityIcon startAnimating];

it disable all user interactions so when the user Tap on Cancel button which should abort the download process and hide the UIActivityIndicator it does not work!!!

any suggestions would be appreciated.

Edit: I am using separate thread to download the files in the background. All progress reporting and UI interaction I made it through:

[self performSelectorOnMainThread:@selector(RefreshScreen:) withObject:nil waitUntilDone:YES];

and RefreshScreen method is the one who interact with the UI elements.

Upvotes: 2

Views: 1239

Answers (1)

Nicos Karalis
Nicos Karalis

Reputation: 3773

try change this line: [request startSynchronous]; to: [request startAsynchronous];

EDIT

- (IBAction)grabURLInBackground:(id)sender
{
   NSURL *url = [NSURL URLWithString:@"http://allseeing-i.com"];
   ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
   [request setDelegate:self];
   [request startAsynchronous];
}

- (void)requestFinished:(ASIHTTPRequest *)request
{
   // Use when fetching text data
   NSString *responseString = [request responseString];

   // Use when fetching binary data
   NSData *responseData = [request responseData];
}

- (void)requestFailed:(ASIHTTPRequest *)request
{
   NSError *error = [request error];
}

Upvotes: 3

Related Questions