title: Objective-C, how to display determinate progress bar?
body: <p>I would like to show the progress bar in my app as determinate rather than indeterminate. It doesn't work though when setting it up as determinate (works just fine for indeterminate). I've <a href="https://stackoverflow.com/questions/4089555/animated-progress-bar-in-nsmenuitem">read some</a> of the <a href="https://stackoverflow.com/questions/3784230/displaying-file-copy-progress-using-fscopyobjectasync">other</a> answers to this, although they haven't worked. Any help would be appreciated - thanks!</p>
  
  <pre><code>@interface AppDelegate : NSObject &lt;NSApplicationDelegate&gt; {
  
      IBOutlet NSProgressIndicator *showProgress;
  
  }
  
  - (IBAction)someMethod:(id)sender {
  
      [showProgress setUsesThreadedAnimation:YES];   // This works
      [showProgress startAnimation:self];            // This works
      [showProgress setDoubleValue:(0.1)];           // This does not work
      [showProgress setIndeterminate:NO];            // This does not work
  
      [self doSomething];
      [self doSomethingElse];
      [self doSomethingMore];
      ....
  
      [barProgress setDoubleValue:(1.0)];            // This does not work
      [barProgress stopAnimation:self];              // This works
  
  }
  </code></pre>
  
  <hr>
  
  <p>Updated code [working]:</p>
  
  <pre><code>- (IBAction)someMethod:(id)sender {
  
      [showProgress setUsesThreadedAnimation:YES];
      [showProgress startAnimation:self];
      [showProgress setIndeterminate:NO];
  
      [showProgress setDoubleValue:(0.1)];
      [showProgress startAnimation:nil];
  
      dispatch_queue_t backgroundQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
      dispatch_async(backgroundQueue, ^{
  
          for (NSUInteger i = 0; i &lt; 1; i++) {
  
              dispatch_async(dispatch_get_main_queue(), ^{
                  [barProgress incrementBy:10.0];
              });
          }
  
      [self doSomething];
  
              [showProgress incrementBy:...];
  
          dispatch_async(dispatch_get_main_queue(), ^{
  
              [showProgress stopAnimation:nil];
  
          });
      });
  
      [showProgress setDoubleValue:(1.0)];
  }
  </code></pre>