视图控制器可以拥有一张表吗? [英] Can a view controller own a sheet?
问题描述
我想从视图控制器中调用工作表(用户点击按钮,将显示工作表)。是否可以使用单独的窗口控制器(具有插口和操作),或者从中调用工作表的视图控制器作为工作表的控制器操作?
I want to call a sheet from within a view controller (user clicks on a button and the sheet will be displayed). Can the sheet have a separate window controller (with outlets and actions) or does the view controller from which the sheet is called operate as the sheet's controller?
以确定如何从单独的Interface Builder(.xib)文件显示表单,而不是我的视图控制器。该表将有一个基于弹出菜单项的列表,所以我想把这个逻辑在一个单独的控制器。我尝试使用 NSWindowController
,但是没有用。
I'm trying to determine how to display a sheet from a separate Interface Builder (.xib) file than my view controller. The sheet will have a list based on a popup menu item, so I would like to put that "logic" in a separate controller. I tried using a NSWindowController
, but that didn't work.
推荐答案
A股NSViewController控制视图;而已。您可以创建拥有该工作表的自定义子类,也可以使其拥有拥有该工作表的窗口控制器。
A stock NSViewController controls a view; nothing more. You can make a custom subclass that owns the sheet, or you can make it own a window controller which owns the sheet. The choice is yours.
尝试使用NSWindowController,但是没有成功。
Tried using a NSWindowController, but that didn't work.
您应该提出另一个问题。
You should ask another question about that.
这篇关于视图控制器可以拥有一张表吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!