Add completion handler to presentViewControllerAsSheet(NSViewController)?

前端 未结 2 800
甜味超标
甜味超标 2021-01-22 01:31

I am attempting to present a sheet configuration view (AddSoundEffect) for my main window/view controller (I\'m using storyboards), and when the configuration view

2条回答
  •  说谎
    说谎 (楼主)
    2021-01-22 02:11

    The easiest way to detect sheet opening or closing is to use the Sheet Notifications:

    class ViewController: NSViewController, NSWindowDelegate {
    
        override func viewDidLoad(){
            NSApplication.sharedApplication().windows.first?.delegate = self
        }
        func windowDidEndSheet(notification: NSNotification) {
    
        }
        func windowWillBeginSheet(notification: NSNotification) {
    
        }
    }
    

提交回复
热议问题