ViewController에서 모달 시트의 위치를 설정하려고합니다. 무엇 I've 지금까지 가지고 이 : 그것은 지금까지 시트가 창의 상단에 표시대로 작동신속한 모달 시트 : willPositionSheet가 호출되지 않습니다.
import Cocoa
class ViewController: NSViewController, NSWindowDelegate {
func window(_ window: NSWindow, willPositionSheet sheet: NSWindow, using rect: NSRect) -> NSRect {
print("function entered")
}
var sheetWindowController: SheetWindowController!
@IBAction func showSheet(_ sender:AnyObject){
let windowController = SheetWindowController(windowNibName: "SheetWindowController")
self.sheetWindowController = windowController
self.sheetWindowController.delegate = self
self.view.window?.beginSheet(self.sheetWindowController.window!, completionHandler: nil)
}
override func viewDidLoad() {
super.viewDidLoad()
self.view.window?.delegate = self
}
}
. 그러나 willPositionSheet
메서드가 호출되지 않습니다. 어떤 아이디어가 빠졌습니까?
[MacOS 문서 기반 응용 프로그램에서 창이 닫힐 때 알아보기] (https://stackoverflow.com/questions/44685445/trying-to-know-when-a-window-closes-in-a- macos- 문서 기반 응용 프로그램). – Willeke