Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Detect NSWindow Maximize or Zoom Event?

How do you detect when a user clicks the green maximize or zoom (+) button on the NSWindow without using the NSWindowDidResizeNotification?

The reason I don't want to use NSWindowDidResizeNotification is because that is also triggered repeatedly as the user clicks and drags to manually resize the window. I have some code that I want to execute and it should only fire once when the user zooms or de-zooms the window using the green button in the top left-hand corner and not many times when manually resizing the window.

like image 573
EagleOfToledo Avatar asked Aug 21 '10 00:08

EagleOfToledo


1 Answers

These two window delegate methods may be useful:

- windowWillUseStandardFrame:defaultFrame:
- windowShouldZoom:toFrame:

You might also consider subclassing NSWindow and overriding the zoom: method.

like image 195
Todd Yandell Avatar answered Oct 05 '22 12:10

Todd Yandell