开发者

asynchronous method executing

I have a delegate method with the following tasks:

  • get something from the internet (ex: some image from a web site);
  • process that image in a certain way;
  • display the result in a subview ;

getting the image takes some time, depending on the network's speed so the result of its processing is displayed in the subview after that little while.

my problem: during the time between getting the image and showing the result the device looks unresponsive. any attempt to put some spinner, or any other method which is called inside this main procedure has no effect until the r开发者_运维技巧esult is processed. how should I change this behaviour? I would like to put a big spinner during that waiting time.

thank you.


See iphone-dev-tips for a very basic approach on asynchronous fetching of a UIImage.


I found the LazyTableImages to be very instructive on how to best implement this behavior. In my opinion, the spinner is to be avoided at all costs.

We also make use of NSOperationQueue to handle background loading of upwards of 500 images without slowing the UI down much.

Cheers, -dan

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜