开发者

NSView - Quick Look and NSResponder

开发者 https://www.devze.com 2023-02-03 22:18 出处:网络
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'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?


Found out my issue. My NSView subclass did not implement the following:

- (BOOL)acceptsFirstResponder
{
    return YES;
}
0

精彩评论

暂无评论...
验证码 换一张
取 消