IRP_HANDLER
IRP_HANDLER

Reputation: 308

Cocoa Appkit - How do I set a custom size for an NSProgressIndicator?

So basically I have this empty view with an NSProgressIndicator:

@interface TestVC : NSViewController

@property IBOutlet NSProgressIndicator *progress;

@end

I want to make it really big like say 300x300, but Xcode only allows a "Small" or a "Regular" size:

enter image description here

I tried changing the frame in the awakeFromNib function:

-(void)awakeFromNib
{
    NSRect customFrame = NSMakeRect(50, 50, 300, 300);
    [progress setFrame:customFrame];
}

but it doesn't work, is there any way to arbitrarily scale an NSProgressIndicator?

I also tried subclassing it:

@implementation CustomProgressBar

- (void)drawRect:(NSRect)dirtyRect
{
    [super drawRect:dirtyRect];
}

-(void)awakeFromNib
{
   [super awakeFromNib];
   [self setFrameSize:NSMakeSize(300, 300)]; 
}

@end

Upvotes: 0

Views: 33

Answers (0)

Related Questions