Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to solve delay of progressView's movement animation
    text
    copied!<p>Currently, I'm downloading data from a web server by calling a method <code>fetchProducts</code>. This is done in another separate thread. As I successfully download fifty items inside the method stated above, I <code>post</code> a notification to the <code>[NSNotification defaultCenter]</code> through the method call <code>postNotificationName: object:</code> which is being listened to by the <code>Observer</code>. Take note that this <code>Observer</code> is another <code>ViewController</code> with the selector <code>updateProductsBeingDownloadedCount:</code>. Now as the <code>Observer</code> gets the notification, I set the property of my <code>progressView</code> and a label that tells the progress. Below is the code I do this change in UI.</p> <pre><code>dispatch_async(dispatch_get_main_queue(), ^{ if ([notif.name isEqualToString:@"DownloadingProducts"]) { [self.progressBar setProgress:self.progress animated:YES]; NSLog(@"SetupStore: progress bar value is %.0f", self.progressBar.progress); self.progressLabel.text = [NSString stringWithFormat:@"Downloading %.0f%% done...", self.progress * 100]; NSLog(@"SetupStore: progress label value is %@", self.progressLabel.text); [self.view reloadInputViews]; } }); </code></pre> <p>The idea is to move the <code>progressView</code> simultaneously as more items were being downloaded until it is finished. In my case, the <code>progressView</code>'s animation will just start right after the items were already downloaded, hence a delay. Kindly enlighten me on this. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload