开发者

NSView - Quick Look and NSResponder

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜