如何在可可应用程序中使用UKKQueue? [英] How to use UKKQueue in a Cocoa application?

查看:70
本文介绍了如何在可可应用程序中使用UKKQueue?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将UKKQueue集成到Cocoa应用程序中。我已经从存储库中下载了这8个文件,并将它们添加到我的Xcode项目。

I'm trying to integrate UKKQueue into a Cocoa application. I've downloaded the 8 files from the repository, and added them into my Xcode project.

但是,我不确定如何在我的Cocoa应用程序中使用UKKQueue。使用UKKQueue下一步需要做什么?

However, I'm not sure how to use a UKKQueue in my Cocoa application. What do I need to do next to use a UKKQueue?

推荐答案

首先查看自述文件,内容为:


只需创建一个UKKQueue(或使用单例),为其添加一些路径,并通过NSWorkspace的通知中心监听
的更改通知

Simply create a UKKQueue (or use the singleton), add a few paths to it and listen to the change notifications via NSWorkspace's notification center

在那之后,代码本质上是自记录的,因此要做的就是查看头文件并查看它们告诉您什么。主文件是 UKKQueue.h ,在这里我们找到UKKQueue对象以及其公共方法和属性的列表。它也采用UKFileWatcher协议,因此请查看 UKFileWatcher.h 了解与UKKQueue对象通话时可以使用的更多方法。

After that, the code is essentially self-documenting, so the thing to do is look at the header files and see what they tell you. The main file is UKKQueue.h, and here we find the UKKQueue object and a list of its public methods and properties. It also adopts the UKFileWatcher protocol, so look at UKFileWatcher.h for more methods you can use when talking to a UKKQueue object.

如自述文件所述,首先 #import UKKQueue.h 到您自己的代码文件中,然后实例化UKKQueue。 (显然,您需要将该实例保留在某个地方。)它有一个委托,因此采用委托协议UKFileWatcherDelegate并将您自己设置为该实例的委托。现在,在该实例上 addPath:,就像自述文件告诉您的那样。

So, as the readme file said, first #import "UKKQueue.h" into your own code file, and then instantiate UKKQueue. (Obviously, you need to retain that instance somewhere.) It has a delegate, so adopt the delegate protocol UKFileWatcherDelegate and set yourself as that instance's delegate. Now addPath: on the instance, just as the readme file told you to.

您已经实现了 watcher:receivedNotification:forPath:(因为您是委托人),所以现在就坐下来等待通知到达。标头告诉您需要什么通知。

You've implemented watcher:receivedNotification:forPath: (because you are the delegate), so now just sit back and wait for notifications to arrive. The headers tell you what notifications to expect.

这就是全部。请注意,我能够在不使用任何这些文件的情况下说出所有这些内容。我一生中从未见过这些文件。只需查看自述文件和标题(当然,还要了解Objective-C和标准模式)即可。如果您无法做到这一点,那么您需要先学习Objective-C,然后自己尝试这种事情。

That's all there is to it. Notice that I was able to say all that without ever having used any of these files; I've never seen any of these files before in my life. It's just a matter of looking at the readme and the headers (and knowing Objective-C and the standard patterns, of course). If you can't do that, then you need to learn Objective-C before trying this sort of thing on your own.

这篇关于如何在可可应用程序中使用UKKQueue?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆