leah / PullToRefresh

A simple iPhone TableViewController for adding pull-to-refresh functionality.
http://blog.leahculver.com/2010/07/iphone-pull-to-refresh.html
MIT License
1.91k stars 252 forks source link

MultiThreading #14

Open macintosh264 opened 12 years ago

macintosh264 commented 12 years ago

Added multithreading to the table so you don't hang up the main thread with network requests.

zadr commented 12 years ago

performSelector:withObject:afterDelay: is non-blocking and will defer to the runloop. I suspect (but haven't bothered benchmarking) that spawning a new thread, and then dispatching back to the main runloop is actually more expensive than letting the runloop handle things outright.

macintosh264 commented 12 years ago

It is useful when executing network requests, and thus is better than letting it run on the main runloop.

monzonj commented 12 years ago

Actually, the refresh method should be replaced by a delegate that performs whatever request is needed to update this table view. This controller is generic and should be oblivious about implementations details