Showing activity indicator during data download
Showing activity indicator during data download
- Subject: Showing activity indicator during data download
- From: DKJ <email@hidden>
- Date: Thu, 29 Oct 2009 00:30:24 -0700
I've implemented an update button like this:
- (IBAction)updateButton:(id)sender
{
[UIApplication sharedApplication].networkActivityIndicatorVisible
= YES;
[downloadIndicator startAnimating];
[[DataManager sharedDataManager] updateDataFiles];
[downloadIndicator stopAnimating];
[UIApplication sharedApplication].networkActivityIndicatorVisible
= NO;
}
And in the DataManager class I have this:
- (void)updateDataFiles
{
NSString *dataString = [NSString stringWithContentsOfURL:url
encoding:NSASCIIStringEncoding
error:NULL];
}
I have the downloadIndicator connected up using IB, and I'm pretty
sure the wiring is OK. But when the button is clicked, I see an
activity indicator spinning in the status bar, but I don't see the one
I implemented myself using IB.
I know it's got something to do with my updateDataFiles method not
being asynchronous, but beyond that I'm at a loss. I'd really rather
avoid writing the extra code to do the download using NSURLConnection
mechanisms: the user can't do anything until the download finishes
anyway.
I'd like to have an alert panel or the second activity indicator
visible during the download. Can someone point me towards a simple
solution?
dkj
PS: I've started reading the "Concurrency Programming Guide", but
that's going to take awhile. And for all I know at present, the
solution for this particular problem may not be in there.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden