Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Resize NSPopover after it is shown

I have an NSPopover who's content in an NSView. I create the popover and add the view like this:

NSPopover *thePopover = [[NSPopover alloc] init];
[thePopover setContentViewController:myViewController];

I then show the popover and set the size:

[thePopover setContentSize:NSMakeSize(300.0f, 160.0f)];

At this point the popover is visible and its content view is correct. Is there a way that I can resize the popover at this point without closing and re-showing it?

like image 819
Chris Avatar asked Jan 22 '13 01:01

Chris


1 Answers

I was able to achieve this by calling back to the controller that launched the popover via a delegate protocol and resetting the size using the setContentSize:

like image 168
Chris Avatar answered Nov 07 '22 20:11

Chris