• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Showing activity indicator during data download
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Showing activity indicator during data download
      • From: Claus Guttesen <email@hidden>
    • Re: Showing activity indicator during data download
      • From: DKJ <email@hidden>
  • Prev by Date: Re: A distinct group of pictures in the bundle
  • Next by Date: NSTextFieldCell subclass hobbles the field editor
  • Previous by thread: Re: 10.4 System Preferences Cannot Find Its Main Window When Launched by a Pane Bundle
  • Next by thread: Re: Showing activity indicator during data download
  • Index(es):
    • Date
    • Thread