开发者

Async image download for UITableViewCell will not fire connectionDidFinishLoading: until scrolling stops

I have a typical UITableView which displays a thumbnail image and some text. During tableView:cellForRowAtIndexPath: I start an async image download for each item in the list. The images are downloading, but not the way I want. For example, if I flick scroll the list, my download requests happen immediately, however, the connectionDidFinishLoading: message will not get fired, until the scro开发者_运维百科lling from the flick scroll comes to a complete stop. Basically, that results in the user seeing a bunch of empty images for a couple of seconds.

If you look at the app store app, for example, when you flick scroll one of the lists, the images begin displaying even when scrolling hasn't stopped. I'm assuming this is due to some kind of multi-threaded solution.

Can someone please provide me with an example of how I can acheive the desired results?

Thanks!


You probably need to do this :

[_connection scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSRunLoopCommonModes];

Assuming _connection is your NSURLConnection.


I ended up solving this myself, since no one on the planet could help me. If you would really like to know how to achieve this, I have described how to modify Apple's LazyTableImages sample project to achieve the desired effect here:

Question about Apple's LazyTableImages sample - Doesn't behave exactly like the app store


take a look at the answer here. lazy loading images in UITableView iPhone SDK i use in in a few of my apps and it works great

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜