Database Reference
In-Depth Information
generates the images on the fly. Storing images with the data is viable only
if the data is stored in a bundle similar to the way that Pages or Numbers
does. When the data is stored in a flat file, like our metadata files, a generator
is the only way to integrate with Quick Look. Fortunately, writing a Quick
Look generator is only slightly more complicated than a Spotlight importer.
Adding the Subproject
Just like the Spotlight importer, the Quick Look generator is created within
its own subproject.
Like the Spotlight importer subproject we added earlier, we need to perform
the following steps:
1.
Create a subproject under our recipes project. Again, I gave mine the very
clever title of QuickLookPlugin .
2.
Drag the project into the main project, and flag it as a dependency.
3.
Add a new copy phase to the main project's target, and set its destination
to wrapper and path to Contents/Library/QuickLook .
4.
Drag the Quick Look plug-in into the new build phase.
If any of these steps are confusing, please see Xcode Subproject , on page 163 .
Once the Quick Look subproject has been added, the main project's tree
should look similar to Figure 40, The Xcode project tree with all plug-ins added ,
on page 170 .
Once the subproject has been set up properly, we will go ahead and rename
the two .c files to .m files so that we can use Objective-C inside them. We need
to also add Foundation.framework to the subproject so that we can utilize the
Foundation APIs.
Unlike Spotlight, Quick Look has two components. There is a thumbnail
generation and a preview generation. The thumbnail is used by the Finder
both in place of a standard file icon and in Cover Flow. The preview is used
when Quick Look is invoked in Finder, Mail, and so on. Therefore, the Quick
Look template creates two .c (now .m ) files, one for each. Let's tackle the
thumbnail file first.
Generating the Quick Look Thumbnail
The file GenerateThumbnailForURL.m has one function inside it that is called by the
Quick Look manager (part of the operating system). This function expects we
will be populating the QLThumbnailRequestRef and returning the OSStatus of noErr .
 
 
Search WWH ::




Custom Search