简体   繁体   English

如何将我的WindowController注册为打印操作的第一响应者?

[英]How can I register my WindowController to be the first responder for a print operation?

I have several nib files, and corresponding WindowController files for each of them. 我有几个笔尖文件,以及每个文件对应的WindowController文件。 My NSMenu is declared in my main nib. 我的NSMenu在主笔尖中声明。

I understand that - print: (id) sender is called when the print command is selected from the menu, however, how can I register one of my WindowControllers to respond to that command when it is the active window? 我知道-从菜单中选择打印命令时,将调用print:(id)sender,但是,当它是活动窗口时,如何注册我的WindowController之一以响应该命令?

Right now I'm not sure what is responding to the command, but a simple print window is appearing. 现在,我不确定命令是否响应,但是出现了一个简单的打印窗口。

To Make any of the View in a window,you have to initialize the windows initialFirstResponder. 要在窗口中创建任何视图,您必须初始化窗口initialFirstResponder。 get into the inspector(tools-->inspector in xcode) for windows you have to link the view which you want to respond first,by linking the connections-->outlets-->intialFirstResponder... 进入Windows的检查器(xcode中的工具->检查器),您必须通过链接连接->出口-> intialFirstResponder来链接要首先响应的视图...

you can move the responders object by shifting nextKeyView attributes of the view 您可以通过移动视图的nextKeyView属性来移动响应者对象

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

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