Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/cocoa/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c 基于cocoa文档的应用程序MVC绑定_Objective C_Cocoa_Nsdocument_Nswindowcontroller_Nsviewcontroller - Fatal编程技术网

Objective c 基于cocoa文档的应用程序MVC绑定

Objective c 基于cocoa文档的应用程序MVC绑定,objective-c,cocoa,nsdocument,nswindowcontroller,nsviewcontroller,Objective C,Cocoa,Nsdocument,Nswindowcontroller,Nsviewcontroller,假设有一个基于文档的应用程序,classDocument子类来自NSDocument,其属性类型为NSArray ViewController是文档的windowController的contentViewController,并且有一个NSArrayController 那么如何将NSArraycontroller的内容绑定到文档的数组 我可以通过在makeWindowControllerfunc中将doc的数组设置为windowController来实现这一点,然后viewControlle

假设有一个基于文档的应用程序,class
Document
子类来自
NSDocument
,其属性类型为
NSArray

ViewController
是文档的
windowController
contentViewController
,并且有一个
NSArrayController

那么如何将
NSArraycontroller
的内容绑定到文档的数组


我可以通过在
makeWindowController
func中将doc的数组设置为windowController来实现这一点,然后viewController从windowController获得了它,但是这太麻烦了吗?有人请告诉我我做得对还是优雅?

windowcontroller和arraycontroller在同一个XIB中吗?它们都在一个故事板中