Question

So I've got a simple UI, A Start button, some text/labels, and a progress bar. When the Start button is click, the NSProgressIndicator should animate. Here's my code:

@synthesize progressBar = progressBar;
 /* Some code and setup stuffs... */
- (IBAction)startAction:(id)sender {
    NSLog(@"Button clicked.");
    NSLog(@"Beginning Socketry and socket creation...");
    [progressBar setUsesThreadedAnimation:YES];
    [progressBar setIndeterminate:YES];
    [progressBar startAnimation:progressBar];
}

I've checked multiple source (Apple Developer Portal, etc.), and nothing works. I don't have to have the NSPIndicator, but it would be really nice if I could. Also, here's my AppDelegate.h file:

#import <Cocoa/Cocoa.h>

@interface AppDelegate : NSObject <NSApplicationDelegate>

@property (assign) IBOutlet NSWindow *window;

@property (readonly, strong, nonatomic) NSPersistentStoreCoordinator *persistentStoreCoordinator;
@property (readonly, strong, nonatomic) NSManagedObjectModel *managedObjectModel;
@property (readonly, strong, nonatomic) NSManagedObjectContext *managedObjectContext;
@property (weak) IBOutlet NSProgressIndicator *progressBar;
- (IBAction)saveAction:(id)sender;

- (IBAction)startAction:(id)sender;

- (IBAction)changeStatus:(id)sender;

- (IBAction)changeProgress:(id)sender;

@end
Was it helpful?

Solution

Go to the Attributes Inspector of the Progress Indicator and set up as shown in the picture below:

enter image description here

See code below:

@synthesize progressBar;
- (IBAction)startAction:(id)sender {
    [progressBar setHidden:NO];
    [progressBar setIndeterminate:YES];
    [progressBar setUsesThreadedAnimation:YES];
    [progressBar startAnimation:nil];
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top