Listen for window resize event in Swift / Objective-C

前端 未结 4 1372
忘了有多久
忘了有多久 2020-12-30 04:35

Is it possible to iterate over all open windows of any application in OSX and listen to their resize events in Swift? I want to create custom window manager that would move

4条回答
  •  孤城傲影
    2020-12-30 05:06

    1. create an NSWindowController Class
    2. Open your storyboard and find your window controller then set the Class as custom Class (identity inspect tab)
    3. create an NSWindowDelegate Class with windowWillResize method
    4. set the NSWindowDelegate instance as the window.delegate property of your NSWindowController instance

    When user change window size,the windowWillResize method will be called.

提交回复
热议问题