iPhone 上的 NSOperation [英] NSOperation on the iPhone
问题描述
我一直在寻找一些具体的场景,当 iPhone 上的 NSOperation
是在应用程序中使用的理想工具时.据我了解,这是编写您自己的 threaded
代码的包装器.我还没有看到任何使用它的 Apple 演示应用程序,我想知道我是否错过了一个很棒的工具而不是使用 NSThread
.
I've been looking for some concrete scenarios for when NSOperation
on the iPhone is an ideal tool to use in an application. To my understanding, this is a wrapper around writing your own threaded
code. I haven't seen any Apple demo apps using it, and I'm wondering if I'm missing out on a great tool instead of using NSThread
.
这里的理想解决方案是描述 NSOperation
的用例场景以及您将如何使用它来解决您的问题.
The ideal solution here would be to describe a use-case scenario for NSOperation
and how you would use it to solve your problem(s).
推荐答案
Cocoa Is My Girlfriend has a 关于NSOperation
和NSOperationQueue
使用的好教程.本教程使用 NSOperation
在不同的线程中同时下载多个网页.
Cocoa Is My Girlfriend has a good tutorial on the use of NSOperation
and NSOperationQueue
. The tutorial makes use of NSOperation
to download several webpages simultaneously in separate threads.
另外,请参阅来自 Mac Research 的这篇文章.
Also, see this article from Mac Research.
这篇关于iPhone 上的 NSOperation的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!