2

I know IKImageBrowserView can be set to take control of the QuickLook panel, but how can I show that panel programmatically?

Thank you

user732274
  • 1,069
  • 1
  • 12
  • 28
  • 1
    Truth to be told, I'm able to show that panel using this trick: I set the browser as the first responder and then I simulate the keystroke of the spacebar. Is there any cleaner solution? – user732274 Apr 18 '12 at 09:09
  • 1
    a bit hackisch.. and what if space isnt configured to show QL -> a custom view can ignore it/ have another key for it odor.. the user could change it or apple could in 10.9 .. no emulating key presses isn't so cool IMO – Daij-Djan May 05 '13 at 19:41

2 Answers2

2
[ik.window makeFirstResponder:ik];
QLPreviewPanel *panel = [QLPreviewPanel sharedPreviewPanel];
[panel updateController];
[panel makeKeyAndOrderFront:nil];
Daij-Djan
  • 49,552
  • 17
  • 113
  • 135
0

As long as your -[IKImageBrowserItem imageRepresentationType] returns IKImageBrowserNSURLRepresentationType or IKImageBrowserPathRepresentationType, all you have to do is set -[IKImageBrowserView setCanControlQuickLookPanel:YES] and then you will have QuickLook support.

However if the dataSoure return item is neither URLs or paths, you must also implement the QLPreviewItem protocol in your IKImageBrowserView subclass and return the requested URL for the custom cell.

See: IKImageBrowserView class ref for more detailed info

Vincent Wayne
  • 36
  • 1
  • 2
  • I would love to know why this solution which is stated clearly in the IKImageBrowerView class reference does not work for you. – Vincent Wayne May 06 '13 at 00:53
  • That's not what I was asking: when I said "I know IKImageBrowserView can be set to take control of the QuickLook panel" I meant I was already doing what you wrote. And in fact what you wrote is completely different from the answer I accepted. – user732274 May 06 '13 at 08:25