Managment of download in objective-c
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.
- Create a progress delegate protocol for your loader class and have your VC implement the protocol
- Send progress notifications from the loader class, and have your VC listen to the notifications
- 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.
精彩评论