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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With