开发者

Managment of download in objective-c

开发者 https://www.devze.com 2023-03-06 04:54 出处:网络
I have to do a view update in parts of my application. I\'ve a view with a view controller to manage the graphic parts -- two sliders and other objects.

I have to do a view update in parts of my application. I've a view with a view controller to manage the graphic parts -- two sliders and other objects.

I also have another class, with the methods of NSURLConnectionDelegate. In this class, when I receive some data, I want to update the object开发者_StackOverflows of the view -- how can i do this?

The options I thought of are: to pass the view controller to NSURLConnection at creation, or to send a notification from NSURLConnection each time data arrives. NSURLConnection is anynchronous by default, right?

What do you think is better?

Thanks.


  1. Create a progress delegate protocol for your loader class and have your VC implement the protocol
  2. Send progress notifications from the loader class, and have your VC listen to the notifications
  3. Use a library for downloads, people around here seem to like ASIHTTPRequest http://allseeing-i.com/ASIHTTPRequest/ but I've always found plain NSURLConnection satisfactory.
0

精彩评论

暂无评论...
验证码 换一张
取 消