13

I'm developing an application for Mac OS X in Xcode, and I'm trying to implement a button that opens an image in Quicklook mode (like when you select an image in Finder and press <space>).

I would like this to work like Skype for Mac when you click on the little round "eye" icon next to a file that was downloaded during a chat.

Any advice on how to achieve this?

bgh
  • 1,986
  • 1
  • 27
  • 36
  • google search led me to apple guide of how to do this exactly -https://developer.apple.com/library/mac/#documentation/UserExperience/Conceptual/Quicklook_Programming_Guide/Introduction/Introduction.html – Justin Meiners Oct 28 '12 at 21:06
  • 2
    Hi Justin. I came across that document myself, but it does not seem to answer my question. It looks as though the entire document is all about implementing Quick Look generators. For all of the common image types there are generators already. What I want to do is not to implement a generator, but to invoke a Quick Look generator from inside my app, instead of through Finder. – bgh Oct 29 '12 at 18:52
  • it describes how to generate the preview image from a file than you would place it in your own view. Right? maybe im missing something – Justin Meiners Oct 29 '12 at 20:20
  • I don't want to place the preview image in my own view. I would like the preview to display in a standard Quicklook window. It should work exactly like when you quicklook a file through Skype by clicking on the eye-icon. – bgh Oct 30 '12 at 06:23

1 Answers1

28

After revisiting this question, I finally came across a resource that led me in the right direction to solving the problem.

Apple's Quick Look Programming Guide seems to be very focused on the implementation of generators, which was not what I was interested in. This document does not seem to have a section that explains how to display a QuickLook preview from inside of your app. However, I came across an example project (QuickLookDownloader) that very nicely illustrates how it's done.

You basically use the application's shared QLPreviewPanel object. You make the QLPreviewPanel the key window by calling its makeKeyAndOrderFront: method. You then accept (and release) the QLPreviewPanel via the methods of the QLPreviewPanelController protocol. These methods are called on the first object on the responder chain that responds to it when the QLPreviewPanel becomes key. You must also implement the QLPreviewPanelDataSource and QLPreviewPanelDelegate protocols and assign the delegates to the QLPreviewPanel.

There are a few steps that need to be taken, but the example QuickLookDownloader project illustrates it nicely.

bgh
  • 1,986
  • 1
  • 27
  • 36
  • Do you know if QuickLook can be enabled without bringing up the simulator at all? – gran_profaci Mar 24 '22 at 07:42
  • 1
    I'm not sure what you mean by the "simulator". Either way, I haven't worked on this for years, so I doubt I'd be able to give you any useful advice – bgh Mar 24 '22 at 12:51
  • The iOS Simulator. If you don't bring up the simulator, can QuickLook be used? I totally understand of course. Thanks. – gran_profaci Mar 25 '22 at 18:16
  • The window that pops up when you activate QuickLook (eg. when pressing space on a file in Finder) has nothing to do with iOS. If you're looking to embed the preview into your application's window instead of having the QuickLook window pop up, I don't know if that is possible. – bgh Mar 28 '22 at 10:16