gpt4 book ai didi

objective-c - Quicklook 嵌入式预览

转载 作者:可可西里 更新时间:2023-11-01 03:10:40 27 4
gpt4 key购买 nike

来自 quicklook 的文档:

"The consumer portion of Quick Look has three components: a document reader (consisting of a custom view and panel), display bundles for that reader, and an SPI to enable communication with the client. Each of these components has a specific role to play in support of the consumer:

Document reader—Quick Look implements a view (NSView) and panel (NSPanel) customized for displaying document previews. Along with the preview content, the view might include (at the client’s option) controls for manipulating the preview, such as page-forward, page-backward, start playing, rewind, and text-search. A client application can embed this view in its user interface if it chooses. The Quick Look panel contains a Quick Look view and various controls that let the user take some action with the preview, such making the preview image full-screen or starting a slideshow."

我一直在仔细阅读 quicklook 的所有文档和示例,但我都没有看到:

  1. 任何类型的“文档阅读器”组件或访问它的方式的定义。
  2. 任何类型的 SPI,可以显示如何让消费者快速浏览
  3. 对 quicklook 用来显示预览的 NSView 的任何直接访问。

我只想按照文档所说的那样做:将 quicklook 的 View 嵌入到我自己的层次结构中,而不是面板中。该面板当然有丰富的文档。以前有人以这种方式成功使用过 Quicklook 吗?

最佳答案

您要找的类(class)是QLPreviewView , 的一部分 Quartz.framework .这是一个公开课(我相信是在 Lion 中引入的)。 不幸的是,文档团队显然尚未发布其文档,这可能就是您找不到它的原因。 official docs现在可用。

简短的版本是按照您创建任何其他 View 的方式创建它,并设置它的 previewItemid <QLPreviewItem>你提供的。 <QLPreviewItem>协议(protocol) is documented .例如

QLPreviewView *pv = [[QLPreviewView alloc] initWithFrame:frame
style:QLPreviewViewStyleNormal];
[pv setPreviewItem:item];
[myView addSubview:pv];
[pv release];

这是基本概念,YMMV。

它的操作在 2011 年 WWDC session “Mac OS X 和 iOS 上的系统范围预览”(或类似的内容)中有详细介绍。如果您是 Mac OS X 或 iOS 开发者计划的付费成员(member),您应该能够获得该视频。

关于objective-c - Quicklook 嵌入式预览,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4474782/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com