On Thu, Apr 17, 2008 at 2:16 AM, xiaobin <[EMAIL PROTECTED]> wrote:

> hi, all
>
> In my application, I want to download a file from internet. so I use
> NSURLDownload to do it. and using NSRunLoop to wait until finish the
> downloading action. for example 2 seconds. codes as the following


By managing your own runloop, you're making this way harder than it needs to
be. Just open a sheet (or modal panel) with a progress bar, which has its
own runloop. Then make your controller the NSURLDownload object's delegate,
and create a delegate method downloadDidFinish: that closes the sheet/panel.
You can also respond to download:didReceiveDataOfLength: to accurately
update the progress bar.

Delegate methods are key to asynch I/O in Cocoa - it's worthwhile to learn
how to use them.

sherm--

-- 
Cocoa programming in Perl: http://camelbones.sourceforge.net
_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to