Cocoa – get size of nswindow

cocoanswindowsize

Is there any way I get get the size of an NSWindow (in pixels) and display it? So when the person resizes the window the text will change and display the new size.

Best Answer

If you implement the method

- (NSSize)windowWillResize:(NSWindow *)sender toSize:(NSSize)frameSize

on an object you set as the delegate of the window, it will be called whenever the window changes size. From there you can update the text field you use for displaying the size.

Related Topic