简体   繁体   English

我如何在iPhone的后台发送进程?

[英]How i send process in background in iPhone?

I developing an application in which i calling web service and i store online data in NSMutableArray. 我开发了一个应用程序,在其中调用Web服务并将在线数据存储在NSMutableArray中。 That array contains some image URL and its title. 该数组包含一些图像URL及其标题。 When i loading that array in my UITableView custom cell the application freeze or did not do anything to me till all image not be loaded (image resolution sometimes bigger than 4300X400) from web server. 当我在UITableView自定义单元中加载该数组时,应用程序冻结或对我没有执行任何操作,直到未从Web服务器加载所有图像(图像分辨率有时大于4300X400)。 So i think it take time fetching data from webserver. 因此,我认为从Web服务器获取数据需要花费时间。 Now i want first display UITableView with all images titles after that i want to send all images loading or data fetching process in background in a queue. 现在,我想先显示具有所有图像标题的UITableView,然后在队列中发送所有图像加载或数据获取过程。 Whenever the image data will loaded it directly get response to corresponding table cell. 每当加载图像数据时,它都会直接获得对相应表格单元格的响应。 And during loading data if i switch the viewController that queue process will automatically release. 并且在加载数据期间,如果我切换viewController,则队列进程将自动释放。 How i do that in iphone? 我如何在iPhone中做到这一点? Also above method should applicable for both iPhone3G and iPhone4G. 同样,上述方法也适用于iPhone3G和iPhone4G。

Give me web link if any online tutorial. 如果有在线教程,请给我链接。

Thanks 谢谢

请查看Apple示例代码LazyTableImages (文件:链接到Apple文档),该示例在NSURLConnection上使用了异步方法。

这是一个使用NSOperationQueue进行延迟加载的好例子, http://www.icodeblog.com/2010/03/04/iphone-coding-turbo-charging-your-apps-with-nsoperation/希望对您有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM