NSView - 快速查看和 NSResponder
我已经对 NSView (MyCustomView) 进行了子类化,并使用 MainMenu.xib 中的自定义视图对象将其添加到 InterfaceBuilder 中 NSWindow 的内容视图中。
此后,我添加了代码以接受对 MyCustomView 的“快速查看”响应。
调用此命令后:
[[QLPreviewPanel sharedPreviewPanel] makeKeyAndOrderFront:nil];
它要求出现“快速查看”窗口,显然 QLPreviewPanel 会遍历响应程序链,查找响应 -(BOOL)acceptsPreviewPanelControl: 的任何内容,以便执行其需要的操作。尽管具有快速查看功能的相关方法(包括上述方法),但 MyCustomView 似乎没有响应。
我尝试将以下内容添加到 MyCustomView 的 init 方法中,但没有什么区别:
[self acceptsFirstResponder];
[self becomeFirstResponder];
我缺少什么想法吗?我认为这与我的 xib 设置有关?
I've subclassed NSView (MyCustomView) and have added it to my NSWindow's Content View in InterfaceBuilder using the custom view object in MainMenu.xib.
I have since added code to accept Quick Look responses to MyCustomView.
After calling this:
[[QLPreviewPanel sharedPreviewPanel] makeKeyAndOrderFront:nil];
Which asks the Quick Look window to appear, apparently the QLPreviewPanel goes through the Responder chain looking for anything that responds to -(BOOL)acceptsPreviewPanelControl: in order to do what it needs to. MyCustomView doesn't seem to be responding, despite having the relevant methods for Quick Look to function, including the aforementioned.
I tried adding the following to my init method of MyCustomView but makes no difference:
[self acceptsFirstResponder];
[self becomeFirstResponder];
Any ideas what I am missing? I assume it's something to do with my xib setup?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
发现了我的问题。我的 NSView 子类没有实现以下内容:
Found out my issue. My NSView subclass did not implement the following: