I'm writing an application using NSWindowDelegate. However, when I resize the window, it doesn't call function:
func windowDidResize(notification: NSNotification)
This is my class
class ViewController: NSViewController, NSWindowDelegate {}
and the storyboard:
I linked delegate to my window. But it doesn't work. Can you help me fix the error? Thank you.
You've declared your window delegate with:
class ViewController: NSViewController, NSWindowDelegate {}
When your screenshot shows the window controller, not the view controller, as being designated as the delegate.
Set your window controller to be the delegate recipient. EG:
class MyWindowController : NSWindowController, NSWindowDelegate {}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.