Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Indeterminate NSProgressIndicator will not animate

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
like image 874
Ech0riginal Avatar asked Feb 13 '13 19:02

Ech0riginal


1 Answers

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];
}
like image 183
Tosin Ogunrinde Avatar answered Nov 01 '22 07:11

Tosin Ogunrinde