【问题标题】:Modal sheet is not attached to window模态表未附加到窗口
【发布时间】:2015-09-08 14:06:59
【问题描述】:

我正在尝试在我的根窗口中调用模态表。我已成功显示工作表,但它未附加到主窗口

我有read about similar problem:

  1. 设置了窗口出口(由XCode自动设置)
  2. 在启动时可见选项未选中。

我的应用程序有情节提要(下图),我正在从根窗口控制器调用工作表。我尝试从 Root Split View Controller 调用工作表,但没有成功。

let loginWindow = LoginWindowController(windowNibName: "LoginWindowController")

self.window?.beginSheet(loginWindow.window!, completionHandler: { (res) -> Void in
    print("completed")
})

【问题讨论】:

    标签: macos swift nsviewcontroller nssplitview


    【解决方案1】:

    我尝试在 viewDidLoad 中调用 beginSheet(也可以使用 presentViewControllerAsSheetperformSegueWithIdentifier 来显示工作表)强>方法。那是错误。

    只有在视图出现后才能调用工作表。然后工作表将被正确放置在窗口内并且没有窗口/视图层次结构错误。

    现在我在 viewDidAppear 方法中调用工作表,一切正常

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-01-14
      • 1970-01-01
      • 2016-11-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-09-17
      相关资源
      最近更新 更多