简体   繁体   English

在故事板上的拆分视图控制器的一个窗格中未调用NSDocument init

[英]NSDocument init not called in one pane of split view controller in a storyboard

I have a document-based application that works. 我有一个有效的基于文档的应用程序。

I added an NSSplitViewController , pointed the storyboard entry point to it, moved the document's view controller to a pane in the split view controller, and moved the document's view to one of the split view controller's views. 我添加了一个NSSplitViewController ,将情节NSSplitViewController入口指向它,将文档的视图控制器移至拆分视图控制器中的窗格,并将文档的视图移至拆分视图控制器的视图之一。 The other split view controller view will contain info that is not part of the document but will serve as a source for info that the user may add to the document. 另一个拆分视图控制器视图将包含的信息不是文档的一部分,但将用作用户可以添加到文档中的信息的来源。

Everything seems to work fine, except my document's init method is never called. 一切似乎都正常,除非从未调用过我文档的init方法。 I don't understand enough about the application initialization process with respect to the storyboard to fix this. 对于故事板,我对应用程序初始化过程了解得不够多,无法解决此问题。

Any suggestions? 有什么建议么?

Are you linking your documents view controller in storyboard to a your class? 您是否将情节提要中的文档视图控制器链接到您的课程?

将情节提要链接到课程

In [myTableViewController viewDidLoad] I added an explicit call to [[Document alloc] init] which did the trick. 在[myTableViewController viewDidLoad]中,我对[[Document alloc] init]进行了显式调用,从而达到了目的。

I still don't know why I did not have to do this in the simpler version, but I have to move on. 我仍然不知道为什么在较简单的版本中不必这样做,但是我必须继续。 I've wasted too much time on this as it is. 我在这方面浪费了太多时间。

Thanks for looking at this question. 感谢您关注这个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM